chore: Проверки для типов
This commit is contained in:
parent
6fdc3eb46b
commit
5d3fae4249
15 changed files with 125 additions and 42 deletions
|
|
@ -81,7 +81,7 @@ class Primitive {
|
|||
|
||||
if ($month != 0 && $day != 0 && $year != 0) {
|
||||
if (checkdate($month, $day, $year)) {
|
||||
return mktime(0, 0, 0, $month, $day, $year);
|
||||
return mktime(0, 0, 0, $month, $day, $year) ?: 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ class Primitive {
|
|||
$tmp = [];
|
||||
if (preg_match('/(\d+)-(\d+)-(\d+)T(\d+):(\d+)Z/', $value, $tmp)) {
|
||||
if (checkdate((int)$tmp[2], (int)$tmp[3], (int)$tmp[1])) {
|
||||
$result = mktime((int)$tmp[4], (int)$tmp[5], 0, (int)$tmp[2], (int)$tmp[3], (int)$tmp[1]);
|
||||
$result = mktime((int)$tmp[4], (int)$tmp[5], 0, (int)$tmp[2], (int)$tmp[3], (int)$tmp[1]) ?: 0;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue