Total Complexity | 7 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | #[Attribute(Attribute::TARGET_PROPERTY)] |
||
12 | class DateTimeInPast extends AbstractValidation |
||
13 | { |
||
14 | private ?DateTimeInterface $now = null; |
||
15 | |||
16 | public function __construct(?string $message = 'The date/time should be in the past') |
||
20 | } |
||
21 | |||
22 | public function setNow(DateTimeInterface $now): void |
||
25 | } |
||
26 | |||
27 | public function getNow(): DateTimeInterface |
||
28 | { |
||
29 | return $this->now instanceof DateTimeInterface ? $this->now : new DateTimeImmutable(); |
||
30 | } |
||
31 | |||
32 | protected function isValid($input, array $context = []): bool |
||
43 | } |
||
44 | } |
||
46 |