| @@ 32-48 (lines=17) @@ | ||
| 29 | * @throws InvalidArgumentException If the provided date/time is invalid. |
|
| 30 | * @return self |
|
| 31 | */ |
|
| 32 | public function setCreated($created) |
|
| 33 | { |
|
| 34 | if ($created === null) { |
|
| 35 | $this->created = null; |
|
| 36 | return $this; |
|
| 37 | } |
|
| 38 | if (is_string($created)) { |
|
| 39 | $created = new DateTime($created); |
|
| 40 | } |
|
| 41 | if (!($created instanceof DateTimeInterface)) { |
|
| 42 | throw new InvalidArgumentException( |
|
| 43 | 'Invalid "Created" value. Must be a date/time string or a DateTime object.' |
|
| 44 | ); |
|
| 45 | } |
|
| 46 | $this->created = $created; |
|
| 47 | return $this; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @return DateTimeInterface|null |
|
| @@ 63-79 (lines=17) @@ | ||
| 60 | * @throws InvalidArgumentException If the provided date/time is invalid. |
|
| 61 | * @return self |
|
| 62 | */ |
|
| 63 | public function setLastModified($lastModified) |
|
| 64 | { |
|
| 65 | if ($lastModified === null) { |
|
| 66 | $this->lastModified = null; |
|
| 67 | return $this; |
|
| 68 | } |
|
| 69 | if (is_string($lastModified)) { |
|
| 70 | $lastModified = new DateTime($lastModified); |
|
| 71 | } |
|
| 72 | if (!($lastModified instanceof DateTimeInterface)) { |
|
| 73 | throw new InvalidArgumentException( |
|
| 74 | 'Invalid "Last Modified" value. Must be a date/time string or a DateTime object.' |
|
| 75 | ); |
|
| 76 | } |
|
| 77 | $this->lastModified = $lastModified; |
|
| 78 | return $this; |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * @return DateTimeInterface|null |
|
| @@ 165-181 (lines=17) @@ | ||
| 162 | * @throws InvalidArgumentException If the timestamp is invalid. |
|
| 163 | * @return ObjectRevision Chainable |
|
| 164 | */ |
|
| 165 | public function setRevTs($revTs) |
|
| 166 | { |
|
| 167 | if ($revTs === null) { |
|
| 168 | $this->revTs = null; |
|
| 169 | return $this; |
|
| 170 | } |
|
| 171 | if (is_string($revTs)) { |
|
| 172 | $revTs = new DateTime($revTs); |
|
| 173 | } |
|
| 174 | if (!($revTs instanceof DateTimeInterface)) { |
|
| 175 | throw new InvalidArgumentException( |
|
| 176 | 'Invalid "Revision Date" value. Must be a date/time string or a DateTimeInterface object.' |
|
| 177 | ); |
|
| 178 | } |
|
| 179 | $this->revTs = $revTs; |
|
| 180 | return $this; |
|
| 181 | } |
|
| 182 | ||
| 183 | /** |
|
| 184 | * @return DateTimeInterface|null |
|