@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public static function sort(array $timePeriods) |
33 | 33 | { |
34 | 34 | // Closure in PHP 7.0.X loop maybe die |
35 | - usort($timePeriods, function ($a, $b) { |
|
35 | + usort($timePeriods, function($a, $b) { |
|
36 | 36 | if ($a[0] == $b[0]) { |
37 | 37 | // Start time is equal, compare end time |
38 | 38 | $r = $a[1] < $b[1] ? -1 : 1; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | // If not array, throw exception. |
334 | 334 | (!is_array($timePeriods)) && self::throwException('Time periods format error !', 400); |
335 | 335 | |
336 | - array_walk($timePeriods, function ($tp) { |
|
336 | + array_walk($timePeriods, function($tp) { |
|
337 | 337 | // filter format, number |
338 | 338 | (!is_array($tp) || sizeof($tp) != 2) && self::throwException('Time periods format error !', 400); |
339 | 339 | |
@@ -365,22 +365,22 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | // filter format, number |
368 | - $timePeriods = array_filter($timePeriods, function ($tp) { |
|
368 | + $timePeriods = array_filter($timePeriods, function($tp) { |
|
369 | 369 | return !is_array($tp) || sizeof($tp) != 2 ? false : true; |
370 | 370 | }); |
371 | 371 | |
372 | 372 | // filter time period |
373 | - $timePeriods = array_filter($timePeriods, function ($tp) { |
|
373 | + $timePeriods = array_filter($timePeriods, function($tp) { |
|
374 | 374 | return $tp[0] >= $tp[1] ? false : true; |
375 | 375 | }); |
376 | 376 | |
377 | 377 | // filter time format |
378 | - $timePeriods = array_filter($timePeriods, function ($tp) { |
|
378 | + $timePeriods = array_filter($timePeriods, function($tp) { |
|
379 | 379 | return self::getFilterDatetime() && (!self::isDatetime($tp[0]) || !self::isDatetime($tp[1])) ? false : true; |
380 | 380 | }); |
381 | 381 | |
382 | 382 | // Time carry: ex: 2019-06-01 24:10:22 => 2019-06-02 00:10:22 |
383 | - $timePeriods = array_map(function ($tp) { |
|
383 | + $timePeriods = array_map(function($tp) { |
|
384 | 384 | $tp[0] = substr($tp[0], 11, 2) == '24' ? self::extendTime($tp[0], 0) : $tp[0]; |
385 | 385 | $tp[1] = substr($tp[1], 11, 2) == '24' ? self::extendTime($tp[1], 0) : $tp[1]; |
386 | 386 | return $tp; |