Lines
66.66%
2 / 3
Methods
50.00%
1 / 2
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | ||
| __toString | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| 11 | final readonly class StorePrefix implements Stringable | |
| 12 | { | |
| 13 | /** @throws StoreSetupException */ | |
| 14 | public function __construct(public string $value) | |
| 15 | { | |
| 16 | if (preg_match('/\A[A-Za-z0-9][A-Za-z0-9._-]{0,63}\z/', $value) !== 1) { | |
| 17 | throw StoreSetupException::createForReason(StoreSetupError::PrefixInvalid, prefix: $value); | |
| 18 | } | |
| 19 | } | |
| 20 | ||
| 21 | public function __toString(): string | |
| 22 | { | |
| 23 | return $this->value; | |
| 24 | } | |
| 25 | } |