| @@ 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. |
|
| @@ 177-187 (lines=11) @@ | ||
| 174 | * @returns $this |
|
| 175 | * @throws InvalidArgumentException If an argument is invalid. |
|
| 176 | */ |
|
| 177 | public function setTimestamp( $timestamp ) { |
|
| 178 | if ( ! $timestamp instanceof DateTime ) { |
|
| 179 | try { |
|
| 180 | $timestamp = new DateTime( $timestamp ); |
|
| 181 | } catch ( \Exception $ex ) { |
|
| 182 | throw new InvalidArgumentException( __METHOD__ . ': Invalid timestamp', 0, $ex ); |
|
| 183 | } |
|
| 184 | } |
|
| 185 | $this->timestamp = $timestamp; |
|
| 186 | return $this; |
|
| 187 | } |
|
| 188 | ||
| 189 | /** |
|
| 190 | * Compare timestamps. |
|