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