1 | <?php declare(strict_types=1); |
||
28 | abstract class DatabaseItem |
||
29 | { |
||
30 | /** |
||
31 | * @return string |
||
32 | */ |
||
33 | abstract protected function getDbDateFormat(): string; |
||
34 | |||
35 | /** Field name */ |
||
36 | const FIELD_CREATED_AT = 'created_at'; |
||
37 | |||
38 | /** Field name */ |
||
39 | const FIELD_UPDATED_AT = 'updated_at'; |
||
40 | |||
41 | /** |
||
42 | * @var DateTimeInterface|null |
||
43 | */ |
||
44 | private $createdAtField; |
||
45 | |||
46 | /** |
||
47 | * @var DateTimeInterface|null |
||
48 | */ |
||
49 | private $updatedAtField; |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | 3 | public function getCreatedAt(): ?DateTimeInterface |
|
65 | |||
66 | /** |
||
67 | * @inheritdoc |
||
68 | */ |
||
69 | 4 | public function getUpdatedAt(): ?DateTimeInterface |
|
80 | |||
81 | /** |
||
82 | * @param DateTimeInterface $createdAt |
||
83 | * |
||
84 | * @return DatabaseItem |
||
85 | */ |
||
86 | 25 | protected function setCreatedAtImpl(DateTimeInterface $createdAt): DatabaseItem |
|
92 | |||
93 | /** |
||
94 | * @param DateTimeInterface $updatedAt |
||
95 | * |
||
96 | * @return DatabaseItem |
||
97 | */ |
||
98 | 5 | protected function setUpdatedAtImpl(DateTimeInterface $updatedAt): DatabaseItem |
|
104 | |||
105 | /** |
||
106 | * @param string $createdAt |
||
107 | * |
||
108 | * @return DateTimeInterface |
||
109 | * |
||
110 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
111 | */ |
||
112 | 4 | protected function parseDateTime(string $createdAt): DateTimeInterface |
|
116 | |||
117 | /** |
||
118 | * @param string $name |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | 39 | protected function hasDynamicProperty(string $name): bool |
|
126 | } |
||
127 |