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