| Total Complexity | 5 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class Primitive implements Type |
||
| 14 | { |
||
| 15 | private $function; |
||
| 16 | |||
| 17 | 20 | public function __construct(string $primitive) |
|
| 18 | { |
||
| 19 | 20 | if (!function_exists('is_'.$primitive)) { |
|
| 20 | 3 | throw new NotAPrimitiveType($primitive); |
|
| 21 | } |
||
| 22 | |||
| 23 | 17 | $this->function = 'is_'.$primitive; |
|
| 24 | 17 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * {@inheritdoc} |
||
| 28 | */ |
||
| 29 | 14 | public function accepts($value): bool |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritdoc} |
||
| 36 | */ |
||
| 37 | 4 | public static function fromString(Str $value): Type |
|
| 46 |