Mercurial > hg > cmmr2012-drupal-site
comparison vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocation.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 |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | |
2 namespace TYPO3\PharStreamWrapper\Resolver; | |
3 | |
4 /* | |
5 * This file is part of the TYPO3 project. | |
6 * | |
7 * It is free software; you can redistribute it and/or modify it under the terms | |
8 * of the MIT License (MIT). For the full copyright and license information, | |
9 * please read the LICENSE file that was distributed with this source code. | |
10 * | |
11 * The TYPO3 project - inspiring people to share! | |
12 */ | |
13 | |
14 use TYPO3\PharStreamWrapper\Exception; | |
15 | |
16 class PharInvocation | |
17 { | |
18 /** | |
19 * @var string | |
20 */ | |
21 private $baseName; | |
22 | |
23 /** | |
24 * @var string | |
25 */ | |
26 private $alias; | |
27 | |
28 /** | |
29 * @var bool | |
30 * @see \TYPO3\PharStreamWrapper\PharStreamWrapper::collectInvocation() | |
31 */ | |
32 private $confirmed = false; | |
33 | |
34 /** | |
35 * Arbitrary variables to be used by interceptors as registry | |
36 * (e.g. in order to avoid duplicate processing and assertions) | |
37 * | |
38 * @var array | |
39 */ | |
40 private $variables; | |
41 | |
42 /** | |
43 * @param string $baseName | |
44 * @param string $alias | |
45 */ | |
46 public function __construct($baseName, $alias = '') | |
47 { | |
48 if ($baseName === '') { | |
49 throw new Exception( | |
50 'Base-name cannot be empty', | |
51 1551283689 | |
52 ); | |
53 } | |
54 $this->baseName = $baseName; | |
55 $this->alias = $alias; | |
56 } | |
57 | |
58 /** | |
59 * @return string | |
60 */ | |
61 public function __toString() | |
62 { | |
63 return $this->baseName; | |
64 } | |
65 | |
66 /** | |
67 * @return string | |
68 */ | |
69 public function getBaseName() | |
70 { | |
71 return $this->baseName; | |
72 } | |
73 | |
74 /** | |
75 * @return null|string | |
76 */ | |
77 public function getAlias() | |
78 { | |
79 return $this->alias; | |
80 } | |
81 | |
82 /** | |
83 * @return bool | |
84 */ | |
85 public function isConfirmed() | |
86 { | |
87 return $this->confirmed; | |
88 } | |
89 | |
90 public function confirm() | |
91 { | |
92 $this->confirmed = true; | |
93 } | |
94 | |
95 /** | |
96 * @param string $name | |
97 * @return mixed|null | |
98 */ | |
99 public function getVariable($name) | |
100 { | |
101 if (!isset($this->variables[$name])) { | |
102 return null; | |
103 } | |
104 return $this->variables[$name]; | |
105 } | |
106 | |
107 /** | |
108 * @param string $name | |
109 * @param mixed $value | |
110 */ | |
111 public function setVariable($name, $value) | |
112 { | |
113 $this->variables[$name] = $value; | |
114 } | |
115 | |
116 /** | |
117 * @param PharInvocation $other | |
118 * @return bool | |
119 */ | |
120 public function equals(PharInvocation $other) | |
121 { | |
122 return $other->baseName === $this->baseName | |
123 && $other->alias === $this->alias; | |
124 } | |
125 } |