@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | /*** Arguments prepare ***/ |
| 64 | 64 | if (!isset(self::$_options['unitMap'][$unit])) { |
| 65 | - throw new \Exception('Error Unit: ' . $unit, 400); |
|
| 65 | + throw new \Exception('Error Unit: '.$unit, 400); |
|
| 66 | 66 | } |
| 67 | 67 | // conv unit |
| 68 | 68 | $unit = self::$_options['unitMap'][$unit]; |
| 69 | 69 | |
| 70 | 70 | if ($target != 'all' && !isset(self::$_options['unit'][$target])) { |
| 71 | - throw new \Exception('Error Target: ' . $target, 400); |
|
| 71 | + throw new \Exception('Error Target: '.$target, 400); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /* Setting */ |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | if (isset(self::$_options['unit'][$target])) { |
| 96 | 96 | return !isset(self::$_options['unitMap'][$unit]) ? self::$_options['unit'][$target] : self::$_options['unitMap'][$unit]; |
| 97 | 97 | } else { |
| 98 | - throw new \Exception('Error Target: ' . $target, 400); |
|
| 98 | + throw new \Exception('Error Target: '.$target, 400); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -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; |