| Total Complexity | 5 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 13 | final class Symbol |
||
| 14 | { |
||
| 15 | private $value; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param T $value |
||
| 19 | */ |
||
| 20 | 6 | public function __construct($value) |
|
| 21 | { |
||
| 22 | 6 | if (!\is_int($value) && !\is_string($value)) { |
|
| 23 | 1 | throw new InvalidArgumentException( |
|
| 24 | 1 | 'A Symbol can be composed only of an int or a string' |
|
| 25 | ); |
||
| 26 | } |
||
| 27 | |||
| 28 | 5 | $this->value = $value; |
|
| 29 | 5 | } |
|
| 30 | |||
| 31 | /** |
||
| 32 | * @return T |
||
| 33 | */ |
||
| 34 | 1 | public function value() |
|
| 35 | { |
||
| 36 | 1 | return $this->value; |
|
| 37 | } |
||
| 38 | |||
| 39 | 1 | public function __toString(): string |
|
| 42 | } |
||
| 43 | } |
||
| 44 |