PHP 8.3.31
Preview: ManifestLoader.php Size: 1.41 KB
/home/getspomw/royalsquad.us/vendor/phar-io/manifest/src/ManifestLoader.php

<?php declare(strict_types = 1);
/*
 * This file is part of PharIo\Manifest.
 *
 * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 */
namespace PharIo\Manifest;

use function sprintf;

class ManifestLoader {
    public static function fromFile(string $filename): Manifest {
        try {
            return (new ManifestDocumentMapper())->map(
                ManifestDocument::fromFile($filename)
            );
        } catch (Exception $e) {
            throw new ManifestLoaderException(
                sprintf('Loading %s failed.', $filename),
                (int)$e->getCode(),
                $e
            );
        }
    }

    public static function fromPhar(string $filename): Manifest {
        return self::fromFile('phar://' . $filename . '/manifest.xml');
    }

    public static function fromString(string $manifest): Manifest {
        try {
            return (new ManifestDocumentMapper())->map(
                ManifestDocument::fromString($manifest)
            );
        } catch (Exception $e) {
            throw new ManifestLoaderException(
                'Processing string failed',
                (int)$e->getCode(),
                $e
            );
        }
    }
}

Directory Contents

Dirs: 3 × Files: 3

Name Size Perms Modified Actions
- drwxrwxrwx 2026-04-21 09:23:32
Edit Download
values DIR
- drwxrwxrwx 2026-04-21 08:55:44
Edit Download
xml DIR
- drwxrwxrwx 2026-04-21 10:25:27
Edit Download
4.88 KB lrw-rw-rw- 2025-09-17 06:53:36
Edit Download
1.41 KB lrw-rw-rw- 2025-09-17 06:53:36
Edit Download
5.88 KB lrw-rw-rw- 2025-09-17 06:53:36
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).