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