| Total Complexity | 4 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Name |
||
| 11 | { |
||
| 12 | /** @var string */ |
||
| 13 | private $name; |
||
| 14 | |||
| 15 | /** @var string[] Packages, sub-packages and class/interface/trait name */ |
||
| 16 | private $parts; |
||
| 17 | |||
| 18 | public static function from(string $text): Name |
||
| 21 | } |
||
| 22 | |||
| 23 | public function namespace(): string |
||
|
|
|||
| 24 | { |
||
| 25 | return implode('\\', \array_slice($this->parts, 0, -1)); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function __toString() |
||
| 29 | { |
||
| 30 | return $this->name; |
||
| 31 | } |
||
| 32 | |||
| 33 | private function __construct(string $name) |
||
| 37 | } |
||
| 38 | } |
||
| 39 |