| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | abstract class TimestampValueObject implements TimestampValueObjectInterface |
||
| 12 | { |
||
| 13 | private $value; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @throws Exception if value is invalid |
||
| 17 | */ |
||
| 18 | public function __construct(DateTimeImmutable $value) |
||
| 19 | { |
||
| 20 | $this->guard($value); |
||
| 21 | $this->value = $value; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function getDateTime(): DateTimeImmutable |
||
| 25 | { |
||
| 26 | return $this->value; |
||
| 27 | } |
||
| 28 | |||
| 29 | public function equals(TimestampValueObjectInterface $other): bool |
||
| 35 | } |
||
| 36 | |||
| 37 | public function getValue(): int |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @throws Exception if value is invalid |
||
| 44 | */ |
||
| 45 | abstract protected function guard(DateTimeImmutable $value): void; |
||
| 46 | } |
||
| 47 |