Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | abstract class DateFormatValueObject implements DateFormatValueObjectInterface |
||
13 | { |
||
14 | private $value; |
||
15 | |||
16 | private $format; |
||
17 | |||
18 | /** |
||
19 | * @throws Exception if value is invalid |
||
20 | */ |
||
21 | public function __construct(DateTimeImmutable $value, string $format = DateTime::ATOM) |
||
22 | { |
||
23 | $this->guard($value, $format); |
||
24 | $this->value = $value; |
||
25 | $this->format = $format; |
||
26 | } |
||
27 | |||
28 | public function getValue(): string |
||
31 | } |
||
32 | |||
33 | public function equals(DateFormatValueObjectInterface $other): bool |
||
39 | } |
||
40 | |||
41 | public function getDateTime(): DateTimeImmutable |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @throws Exception if value is invalid |
||
48 | */ |
||
49 | abstract protected function guard(DateTimeImmutable $value, string $format): void; |
||
50 | } |
||
51 |