Lines
100.00%
5 / 5
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 2 | ||
| __toString | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 11 | final readonly class Gamefile implements Stringable | |
| 12 | { | |
| 13 | /** @var non-empty-string */ | |
| 14 | public string $value; | |
| 15 | ||
| 16 | public function __construct(string $value) | |
| 17 | { | |
| 18 | $value = Type\non_empty_string()->assert($value); | |
| 19 | ||
| 20 | if (!str_ends_with($value, '.swf')) { | |
| 21 | throw new InvalidArgumentException("Gamefile must end with '.swf', got '{$value}'."); | |
| 22 | } | |
| 23 | ||
| 24 | $this->value = $value; | |
| 25 | } | |
| 26 | ||
| 27 | public function __toString(): string | |
| 28 | { | |
| 29 | return $this->value; | |
| 30 | } | |
| 31 | } |