Add type-safe wrapper around strtotime, removing ability for second
param.
This commit is contained in:
1 parent
523cdaa7f4
commit
a09eba6b84
1 file changed
+15
+15
@@ -154,6 +154,21 @@ public static function json_encode(array $value, int $options = 0, int $depth =
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Type-safe wrapper around strtotime().
|
||||
*
|
||||
* @param string $datetime String to convert.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public static function strtotime(string $datetime):int {
|
||||
|
||||
$output = strtotime($datetime);
|
||||
if ($output === false) throw new MDInvalidInputDate("Invalid input date {$datetime}.");
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for curling contents from the web.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user