Lines
80.00%
4 / 5
Methods
50.00%
1 / 2
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 2 | ||
| __toString | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| 10 | final readonly class ClassNamespace implements Stringable | |
| 11 | { | |
| 12 | public string $value; | |
| 13 | ||
| 14 | /** @throws ConfigurationException */ | |
| 15 | public function __construct(string $value) | |
| 16 | { | |
| 17 | $namespace = trim($value, '\\'); | |
| 18 | ||
| 19 | if (preg_match('/\A[A-Za-z_][A-Za-z0-9_]*(\\\\[A-Za-z_][A-Za-z0-9_]*)*\z/', $namespace) !== 1) { | |
| 20 | throw ConfigurationException::valueInvalid($value, 'a PHP namespace such as "App\Generated"'); | |
| 21 | } | |
| 22 | ||
| 23 | $this->value = $namespace; | |
| 24 | } | |
| 25 | ||
| 26 | public function __toString(): string | |
| 27 | { | |
| 28 | return $this->value; | |
| 29 | } | |
| 30 | } |