Passed
Branch master (a79827)
by Mars
04:11 queued 02:11
created
src/TimePeriodHelper.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public static function sort(array $timePeriods)
72 72
     {
73 73
         // Closure in PHP 7.0.X loop maybe die
74
-        usort($timePeriods, function ($a, $b) {
74
+        usort($timePeriods, function($a, $b) {
75 75
             if ($a[0] == $b[0]) {
76 76
                 // Start time is equal, compare end time
77 77
                 $r = $a[1] < $b[1] ? -1 : 1;
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
     {
835 835
         /*** Arguments prepare ***/
836 836
         if (!isset(self::$_options['unitMap'][$unit])) {
837
-            throw new \Exception('Error Unit: ' . $unit, 400);
837
+            throw new \Exception('Error Unit: '.$unit, 400);
838 838
         }
839 839
         // conv unit
840 840
         $unit = self::$_options['unitMap'][$unit];
841 841
 
842 842
         if ($target != 'all' && !isset(self::$_options['unit'][$target])) {
843
-            throw new \Exception('Error Target: ' . $target, 400);
843
+            throw new \Exception('Error Target: '.$target, 400);
844 844
         }
845 845
 
846 846
         /* Setting */
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
         if (isset(self::$_options['unit'][$target])) {
868 868
             return self::$_options['unit'][$target];
869 869
         } else {
870
-            throw new \Exception('Error Target: ' . $target, 400);
870
+            throw new \Exception('Error Target: '.$target, 400);
871 871
         }
872 872
     }
873 873
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -768,30 +768,34 @@
 block discarded – undo
768 768
     {
769 769
         // If not array, return.
770 770
         if (!is_array($timePeriods)) {
771
-            if ($exception)
772
-                throw new \Exception('Time periods format error !', 400);
771
+            if ($exception) {
772
+                            throw new \Exception('Time periods format error !', 400);
773
+            }
773 774
             return [];
774 775
         }
775 776
 
776 777
         foreach ($timePeriods as $k => $tp) {
777 778
             // filter format, number
778 779
             if (!is_array($tp) || sizeof($tp) != 2) {
779
-                if ($exception)
780
-                    throw new \Exception('Time periods format error !', 400);
780
+                if ($exception) {
781
+                                    throw new \Exception('Time periods format error !', 400);
782
+                }
781 783
                 unset($timePeriods[$k]);
782 784
                 continue;
783 785
             }
784 786
             // filter time period
785 787
             if ($tp[0] >= $tp[1]) {
786
-                if ($exception)
787
-                    throw new \Exception('Time periods format error !', 400);
788
+                if ($exception) {
789
+                                    throw new \Exception('Time periods format error !', 400);
790
+                }
788 791
                 unset($timePeriods[$k]);
789 792
                 continue;
790 793
             }
791 794
             // filter time format
792 795
             if (self::getFilterDatetime() && (!self::isDatetime($tp[0]) || !self::isDatetime($tp[1]))) {
793
-                if ($exception)
794
-                    throw new \Exception('Time periods format error !', 400);
796
+                if ($exception) {
797
+                                    throw new \Exception('Time periods format error !', 400);
798
+                }
795 799
                 unset($timePeriods[$k]);
796 800
                 continue;
797 801
             }
Please login to merge, or discard this patch.