[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/ -> Stub.php (source)

   1  <?php
   2  declare(strict_types=1);
   3  namespace TYPO3\PharStreamWrapper\Phar;
   4  
   5  /*
   6   * This file is part of the TYPO3 project.
   7   *
   8   * It is free software; you can redistribute it and/or modify it under the terms
   9   * of the MIT License (MIT). For the full copyright and license information,
  10   * please read the LICENSE file that was distributed with this source code.
  11   *
  12   * The TYPO3 project - inspiring people to share!
  13   */
  14  
  15  /**
  16   * @internal Experimental implementation of Phar archive internals
  17   */
  18  class Stub
  19  {
  20      /**
  21       * @param string $content
  22       * @return self
  23       */
  24      public static function fromContent(string $content): self
  25      {
  26          $target = new static();
  27          $target->content = $content;
  28  
  29          if (
  30              stripos($content, 'Phar::mapPhar(') !== false
  31              && preg_match('#Phar\:\:mapPhar\(([^)]+)\)#', $content, $matches)
  32          ) {
  33              // remove spaces, single & double quotes
  34              // @todo `'my' . 'alias' . '.phar'` is not evaluated here
  35              $target->mappedAlias = trim($matches[1], ' \'"');
  36          }
  37  
  38          return $target;
  39      }
  40  
  41      /**
  42       * @var string
  43       */
  44      private $content;
  45  
  46      /**
  47       * @var string
  48       */
  49      private $mappedAlias = '';
  50  
  51      /**
  52       * @return string
  53       */
  54      public function getContent()
  55      {
  56          return $this->content;
  57      }
  58  
  59      /**
  60       * @return string
  61       */
  62      public function getMappedAlias(): string
  63      {
  64          return $this->mappedAlias;
  65      }
  66  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer