| @@ 173-183 (lines=11) @@ | ||
| 170 | * @returns $this |
|
| 171 | * @throws InvalidArgumentException If an argument is invalid. |
|
| 172 | */ |
|
| 173 | public function setTimestamp( $timestamp ) { |
|
| 174 | if ( ! $timestamp instanceof DateTime ) { |
|
| 175 | try { |
|
| 176 | $timestamp = new DateTime( $timestamp ); |
|
| 177 | } catch ( \Exception $ex ) { |
|
| 178 | throw new InvalidArgumentException( __METHOD__ . ': Invalid timestamp', 0, $ex ); |
|
| 179 | } |
|
| 180 | } |
|
| 181 | $this->timestamp = $timestamp; |
|
| 182 | return $this; |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Compare timestamps. |
|
| @@ 152-162 (lines=11) @@ | ||
| 149 | * @returns $this |
|
| 150 | * @throws InvalidArgumentException If an argument is invalid. |
|
| 151 | */ |
|
| 152 | public function setTimestamp( $timestamp ) { |
|
| 153 | if ( ! $timestamp instanceof DateTime ) { |
|
| 154 | try { |
|
| 155 | $timestamp = new DateTime( $timestamp ); |
|
| 156 | } catch ( \Exception $ex ) { |
|
| 157 | throw new InvalidArgumentException( __METHOD__ . ': Invalid timestamp', 0, $ex ); |
|
| 158 | } |
|
| 159 | } |
|
| 160 | $this->timestamp = $timestamp; |
|
| 161 | return $this; |
|
| 162 | } |
|
| 163 | ||
| 164 | /** |
|
| 165 | * Get the prologue content. |
|