Total Complexity | 5 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
11 | abstract class FloatValueObject implements FloatValueObjectInterface |
||
12 | { |
||
13 | private $value; |
||
14 | |||
15 | /** |
||
16 | * @throws Exception if value is invalid |
||
17 | */ |
||
18 | public function __construct(?float $value) |
||
26 | } |
||
27 | |||
28 | public function equals(FloatValueObjectInterface $other): bool |
||
29 | { |
||
30 | if (static::class !== get_class($other)) { |
||
31 | return false; |
||
32 | } |
||
33 | return $this->getValue() === $other->getValue(); |
||
34 | } |
||
35 | |||
36 | public function getValue(): ?float |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @throws Throwable if value is invalid |
||
43 | */ |
||
44 | abstract protected function guard(?float $value): void; |
||
45 | |||
46 | abstract protected function throwException(?float $value, Throwable $e): Exception; |
||
47 | } |
||
48 |