CoreFiles by mySites.guru
Stub.php59 lines, 1,378 bytes, from Joomla_5.3.4-Stable-Full_Package.zip
Raw History Compare with 5.3.3
md5
04d043881ecb72575ba28220e4a52a4d
sha1
e17b94de7d8a3b658a1dd5d7e6b764eb50bd51e0
sha256
35f7c6f5d90df30bef19657081588559090634e54d1625d109ad92dc8ad47928
<?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 = '';

    /**
     * @return null|string
     */
    public function getContent()
    {
        return $this->content;
    }

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

The same content is in 41 releases, Joomla 5.3.0-rc2 to 5.4.11. See them all, or every version of this file.