CoreFiles by mySites.guru
Stub.php56 lines, 1,344 bytes, from Joomla_5.3.0-beta1-Beta-Full_Package.zip
Raw History Compare with 5.2.0-beta3
md5
e31047cad7940170ad75a213abccdb43
sha1
07b479afc9da136279475e5bc5467a62d248f787
sha256
4ed82d0d11ff1450be5c86bc0c5562aa55e4a3568a1c5c068972df2807e10fd8
<?php
declare(strict_types=1);
namespace TYPO3\PharStreamWrapper\Phar;

/*
 * This file is part of the TYPO3 project.
 *
 * It is free software; you can redistribute it and/or modify it under the terms
 * of the MIT License (MIT). For the full copyright and license information,
 * please read the LICENSE file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */

/**
 * @internal Experimental implementation of Phar archive internals
 */
class Stub
{
    public static function fromContent(string $content): self
    {
        $target = new static();
        $target->content = $content;

        if (
            stripos($content, 'Phar::mapPhar(') !== false
            && preg_match('#Phar\:\:mapPhar\(([^)]+)\)#', $content, $matches)
        ) {
            // remove spaces, single & double quotes
            // @todo `'my' . 'alias' . '.phar'` is not evaluated here
            $target->mappedAlias = trim($matches[1], ' \'"');
        }

        return $target;
    }

    /**
     * @var null|string
     */
    private $content = null;

    /**
     * @var string
     */
    private $mappedAlias = '';

    public function getContent(): ?string
    {
        return $this->content;
    }

    public function getMappedAlias(): string
    {
        return $this->mappedAlias;
    }
}

The same content is in 4 releases, Joomla 5.3.0-beta1 to 5.3.0-rc1. See them all, or every version of this file.