# asctime
$strtime = $ts;
} else {
- throw new TimestampException( __METHOD__ . " : Invalid timestamp - $ts" );
+ throw new TimestampException( __METHOD__ . ": Invalid timestamp - $ts" );
}
if ( !$strtime ) {
try {
$final = new DateTime( $strtime, new DateTimeZone( 'GMT' ) );
} catch ( Exception $e ) {
- throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' );
+ throw new TimestampException( __METHOD__ . ': Invalid timestamp format.', $e->getCode(), $e );
}
if ( $final === false ) {
- throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' );
+ throw new TimestampException( __METHOD__ . ': Invalid timestamp format.' );
}
$this->timestamp = $final;
}
*/
public function getTimestamp( $style = TS_UNIX ) {
if ( !isset( self::$formats[$style] ) ) {
- throw new TimestampException( __METHOD__ . ' : Illegal timestamp output type.' );
+ throw new TimestampException( __METHOD__ . ': Illegal timestamp output type.' );
}
$output = $this->timestamp->format( self::$formats[$style] );
try {
$this->timestamp->setTimezone( new DateTimeZone( $timezone ) );
} catch ( Exception $e ) {
- throw new TimestampException( __METHOD__ . ' Invalid timezone.' );
+ throw new TimestampException( __METHOD__ . ': Invalid timezone.', $e->getCode(), $e );
}
}