Total Complexity | 6 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class Number extends ValueObject |
||
11 | { |
||
12 | /** |
||
13 | * @param mixed $value |
||
14 | * @param mixed ...$other |
||
15 | * @throws \ReflectionException |
||
16 | */ |
||
17 | 2 | public function guard($value, ...$other): void |
|
18 | { |
||
19 | 2 | parent::guard($value); |
|
20 | 2 | if (!is_numeric($value) || is_bool($value)) { |
|
21 | 1 | throw new InvalidVOArgumentException('Value is invalid. Allowed type is integer, float, double, real', $value); |
|
22 | } |
||
23 | 1 | } |
|
24 | |||
25 | /** |
||
26 | * @param string $string |
||
27 | * @return Number |
||
28 | * @throws \ReflectionException |
||
29 | */ |
||
30 | 2 | public static function createFromString(string $string): self |
|
39 | } |
||
40 | } |
||
41 |