1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace ApiGen\Info; |
4: | |
5: | use function strrpos; |
6: | use function strtolower; |
7: | use function substr; |
8: | |
9: | |
10: | class NameInfo |
11: | { |
12: | |
13: | public string $full; |
14: | |
15: | |
16: | public string $fullLower; |
17: | |
18: | |
19: | public string $short; |
20: | |
21: | |
22: | public string $shortLower; |
23: | |
24: | |
25: | public string $namespace; |
26: | |
27: | |
28: | public string $namespaceLower; |
29: | |
30: | |
31: | public function __construct(string $full, ?string $fullLower = null) |
32: | { |
33: | $pos = strrpos($full, '\\'); |
34: | |
35: | $this->full = $full; |
36: | $this->fullLower = $fullLower ?? strtolower($full); |
37: | |
38: | $this->short = $pos === false ? $full : substr($full, $pos + 1); |
39: | $this->shortLower = strtolower($this->short); |
40: | |
41: | $this->namespace = $pos === false ? '' : substr($full, 0, $pos); |
42: | $this->namespaceLower = strtolower($this->namespace); |
43: | } |
44: | } |
45: | |