Total Complexity | 5 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | trait ConfirmableTrait |
||
17 | { |
||
18 | /** |
||
19 | * @var DateTime|null |
||
20 | */ |
||
21 | protected $confirmedAt; |
||
22 | |||
23 | public function getConfirmedAt(): ?DateTime |
||
24 | { |
||
25 | return $this->confirmedAt; |
||
26 | } |
||
27 | |||
28 | public function setConfirmedAt(?DateTime $confirmedAt): void |
||
29 | { |
||
30 | $this->confirmedAt = $confirmedAt; |
||
31 | } |
||
32 | |||
33 | public function setConfirmed(bool $confirmed): void |
||
34 | { |
||
35 | if ($confirmed) { |
||
36 | $this->setConfirmedAt(new DateTime()); |
||
37 | } else { |
||
38 | $this->setConfirmedAt(null); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | public function isConfirmed(): bool |
||
45 | } |
||
46 | } |
||
47 |