1 | <?php |
||
17 | class Name implements TypeNameInterface, \JsonSerializable, \Countable |
||
18 | { |
||
19 | /** |
||
20 | * @var array|string[] |
||
21 | */ |
||
22 | private $chunks; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | private $size; |
||
28 | |||
29 | /** |
||
30 | * @var string|null |
||
31 | */ |
||
32 | private $fqn; |
||
33 | |||
34 | /** |
||
35 | * @var bool |
||
36 | */ |
||
37 | private $global; |
||
38 | |||
39 | /** |
||
40 | * TypeName constructor. |
||
41 | * @param array $chunks |
||
42 | * @param bool $global |
||
43 | */ |
||
44 | 120 | public function __construct(array $chunks, bool $global = false) |
|
50 | |||
51 | /** |
||
52 | * @param string|iterable|TypeNameInterface|null $name |
||
53 | * @param bool|null $global |
||
54 | * @return TypeNameInterface |
||
55 | */ |
||
56 | 120 | public static function new($name, bool $global = null): TypeNameInterface |
|
81 | |||
82 | /** |
||
83 | * @param string|iterable|TypeNameInterface|null $name |
||
84 | * @return bool |
||
85 | */ |
||
86 | 52 | public static function isValid($name): bool |
|
90 | |||
91 | /** |
||
92 | * @param array $chunks |
||
93 | * @param bool $global |
||
94 | * @return Name |
||
95 | */ |
||
96 | 5 | public static function fromArray(array $chunks, bool $global = false): TypeNameInterface |
|
100 | |||
101 | /** |
||
102 | * @param string $fqn |
||
103 | * @param bool|null $global |
||
104 | * @return TypeNameInterface |
||
105 | */ |
||
106 | 120 | public static function fromString(string $fqn, bool $global = null): TypeNameInterface |
|
113 | |||
114 | /** |
||
115 | * @param bool $global |
||
116 | * @return TypeNameInterface |
||
117 | */ |
||
118 | 3 | public static function empty(bool $global = false): TypeNameInterface |
|
122 | |||
123 | /** |
||
124 | * @return \Traversable |
||
125 | */ |
||
126 | 1 | public function getIterator(): \Traversable |
|
130 | |||
131 | /** |
||
132 | * @return bool |
||
133 | */ |
||
134 | 66 | public function isGlobal(): bool |
|
138 | |||
139 | /** |
||
140 | * @return TypeNameInterface |
||
141 | */ |
||
142 | 1 | public function lock(): TypeNameInterface |
|
148 | |||
149 | /** |
||
150 | * @return TypeNameInterface |
||
151 | */ |
||
152 | 1 | public function unlock(): TypeNameInterface |
|
158 | |||
159 | /** |
||
160 | * @return string |
||
161 | */ |
||
162 | 14 | public function getName(): string |
|
166 | |||
167 | /** |
||
168 | * @param string|iterable|TypeNameInterface|null $prefix |
||
169 | * @return TypeNameInterface |
||
170 | */ |
||
171 | 66 | public function in($prefix): TypeNameInterface |
|
179 | |||
180 | /** |
||
181 | * @param string|iterable|TypeNameInterface|null $suffix |
||
182 | * @return TypeNameInterface |
||
183 | */ |
||
184 | 1 | public function append($suffix): TypeNameInterface |
|
188 | |||
189 | /** |
||
190 | * @return array|string[] |
||
191 | */ |
||
192 | 8 | public function getChunks(): array |
|
196 | |||
197 | /** |
||
198 | * @return string |
||
199 | */ |
||
200 | 1 | public function __toString(): string |
|
204 | |||
205 | /** |
||
206 | * @return array |
||
207 | */ |
||
208 | public function __debugInfo(): array |
||
215 | |||
216 | /** |
||
217 | * @return string |
||
218 | */ |
||
219 | 169 | public function getFullyQualifiedName(): string |
|
227 | |||
228 | /** |
||
229 | * @param string|iterable|TypeNameInterface|null $name |
||
230 | * @return bool |
||
231 | */ |
||
232 | 64 | public function is($name): bool |
|
236 | |||
237 | /** |
||
238 | * @return string |
||
239 | */ |
||
240 | 1 | public function jsonSerialize(): string |
|
244 | |||
245 | /** |
||
246 | * @return int |
||
247 | */ |
||
248 | 1 | public function count(): int |
|
252 | } |
||
253 |