Passed
Push — master ( 2d92e4...0d56ed )
by Darío
01:37
created
src/Network/Http.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,8 +127,9 @@
 block discarded – undo
127 127
     {
128 128
         $codes = $this->httpStatusCodes;
129 129
 
130
-        if (!in_array($code, array_keys($codes)))
131
-            throw new \RuntimeException("Status code not supported");
130
+        if (!in_array($code, array_keys($codes))) {
131
+                    throw new \RuntimeException("Status code not supported");
132
+        }
132 133
 
133 134
         return $this->httpStatusCodes[$code];
134 135
     }
Please login to merge, or discard this patch.
test/Network/HttpTest.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,13 +56,11 @@
 block discarded – undo
56 56
         try
57 57
         {
58 58
             $text = $http->getStatusText(65431);
59
-        }
60
-        catch (\Exception $e)
59
+        } catch (\Exception $e)
61 60
         {
62 61
             $errorObject = ($e instanceof \RuntimeException);
63 62
             $message = $e->getMessage();
64
-        }
65
-        finally
63
+        } finally
66 64
         {
67 65
             $this->assertTrue($errorObject, $message);
68 66
         }
Please login to merge, or discard this patch.
src/Util/DateTime.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                 break;
95 95
 
96 96
             case self::LAST_YEAR:
97
-                $year = ((int) date('Y'))- 1;
97
+                $year = ((int) date('Y')) - 1;
98 98
                 break;
99 99
 
100 100
             default:
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 $d->setDate($year, (int) $d->format('m'), (int) $d->format('d'));
143 143
             }
144 144
 
145
-            $d->add(new \DateInterval('P'.($day - 1).'D'));
145
+            $d->add(new \DateInterval('P' . ($day - 1) . 'D'));
146 146
         }
147 147
 
148 148
         return $d;
Please login to merge, or discard this patch.
Braces   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public static function getMonth($month_number)
65 65
     {
66
-        if (!array_key_exists($month_number, self::MONTHS))
67
-            throw new Exception\MonthOutOfRange("Invalid Month");
66
+        if (!array_key_exists($month_number, self::MONTHS)) {
67
+                    throw new Exception\MonthOutOfRange("Invalid Month");
68
+        }
68 69
 
69 70
         return self::MONTHS[$month_number];
70 71
     }
@@ -78,14 +79,17 @@  discard block
 block discarded – undo
78 79
      */
79 80
     public static function create(array $date = [])
80 81
     {
81
-        if (!array_key_exists('day', $date))
82
-            $date["day"] = self::TODAY;
82
+        if (!array_key_exists('day', $date)) {
83
+                    $date["day"] = self::TODAY;
84
+        }
83 85
 
84
-        if (!array_key_exists('month', $date))
85
-            $date["month"] = self::THIS_MONTH;
86
+        if (!array_key_exists('month', $date)) {
87
+                    $date["month"] = self::THIS_MONTH;
88
+        }
86 89
 
87
-        if (!array_key_exists('year', $date))
88
-            $date["year"] = self::THIS_YEAR;
90
+        if (!array_key_exists('year', $date)) {
91
+                    $date["year"] = self::THIS_YEAR;
92
+        }
89 93
 
90 94
         switch ($date['year'])
91 95
         {
@@ -130,13 +134,13 @@  discard block
 block discarded – undo
130 134
                 break;
131 135
         }
132 136
 
133
-        if (is_string($day))
134
-            $d = new \DateTime("$day $month $year");
135
-        else
137
+        if (is_string($day)) {
138
+                    $d = new \DateTime("$day $month $year");
139
+        } else
136 140
         {
137
-            if (in_array($month, self::MONTHS))
138
-                $d = new \DateTime("first day of $month $year");
139
-            else
141
+            if (in_array($month, self::MONTHS)) {
142
+                            $d = new \DateTime("first day of $month $year");
143
+            } else
140 144
             {
141 145
                 $d = new \DateTime("first day of $month");
142 146
                 $d->setDate($year, (int) $d->format('m'), (int) $d->format('d'));
Please login to merge, or discard this patch.
src/Util/ArrayDimension.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
                     $again = true;
40 40
                     $new_config[$param . $glue . $key] = $value;
41 41
                 }
42
+            } else {
43
+                            $new_config[$param] = $configure;
42 44
             }
43
-            else
44
-                $new_config[$param] = $configure;
45 45
         }
46 46
 
47 47
         return (!$again) ? $new_config : self::toUnidimensional($new_config, $glue);
@@ -64,15 +64,17 @@  discard block
 block discarded – undo
64 64
 
65 65
         do
66 66
         {
67
-            if (array_key_exists($key, $haystack))
68
-                $haystack = $haystack[$key];
69
-            else
70
-                return $value;
67
+            if (array_key_exists($key, $haystack)) {
68
+                            $haystack = $haystack[$key];
69
+            } else {
70
+                            return $value;
71
+            }
71 72
 
72 73
             $key = count($needle) ? array_shift($needle) : NULL;
73 74
 
74
-            if (is_null($key))
75
-                return $haystack;
75
+            if (is_null($key)) {
76
+                            return $haystack;
77
+            }
76 78
 
77 79
         } while (!is_null($key));
78 80
     }
Please login to merge, or discard this patch.
test/Error/ErrorTraitTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@
 block discarded – undo
126 126
     public function getContentsFromUrl($filename)
127 127
     {
128 128
         $headers = get_headers($url);
129
-        $exists = stripos($headers[0],"200 OK") ? true : false;
129
+        $exists = stripos($headers[0], "200 OK") ? true : false;
130 130
 
131 131
         if ($exists)
132 132
             return file_get_contents($filename);
Please login to merge, or discard this patch.
Braces   +17 added lines, -16 removed lines patch added patch discarded remove patch
@@ -90,13 +90,11 @@  discard block
 block discarded – undo
90 90
         try
91 91
         {
92 92
             $ctrl->addNonExistingError();
93
-        }
94
-        catch (\Exception $e)
93
+        } catch (\Exception $e)
95 94
         {
96 95
             $errorObject = ($e instanceof \LogicException);
97 96
             $message = $e->getMessage();
98
-        }
99
-        finally
97
+        } finally
100 98
         {
101 99
             $this->assertTrue($errorObject, $message);
102 100
         }
@@ -109,18 +107,20 @@  discard block
 block discarded – undo
109 107
 
110 108
     public function getContentsFromFile($filename)
111 109
     {
112
-        if (file_exists($filename))
113
-            return file_get_contents($filename);
114
-        else
115
-            $this->error(Errno::FILE_NOT_FOUND, $filename);
110
+        if (file_exists($filename)) {
111
+                    return file_get_contents($filename);
112
+        } else {
113
+                    $this->error(Errno::FILE_NOT_FOUND, $filename);
114
+        }
116 115
     }
117 116
 
118 117
     public function getContentsFromFileWithoutFilenameOnError($filename)
119 118
     {
120
-        if (file_exists($filename))
121
-            return file_get_contents($filename);
122
-        else
123
-            $this->error(Errno::FILE_NOT_FOUND);
119
+        if (file_exists($filename)) {
120
+                    return file_get_contents($filename);
121
+        } else {
122
+                    $this->error(Errno::FILE_NOT_FOUND);
123
+        }
124 124
     }
125 125
 
126 126
     public function getContentsFromUrl($filename)
@@ -128,10 +128,11 @@  discard block
 block discarded – undo
128 128
         $headers = get_headers($url);
129 129
         $exists = stripos($headers[0],"200 OK") ? true : false;
130 130
 
131
-        if ($exists)
132
-            return file_get_contents($filename);
133
-        else
134
-            $this->error("URL not found");
131
+        if ($exists) {
132
+                    return file_get_contents($filename);
133
+        } else {
134
+                    $this->error("URL not found");
135
+        }
135 136
     }
136 137
 
137 138
     public function addNonExistingError()
Please login to merge, or discard this patch.
src/Error/ErrorTrait.php 1 patch
Braces   +17 added lines, -13 removed lines patch added patch discarded remove patch
@@ -92,15 +92,16 @@  discard block
 block discarded – undo
92 92
      */
93 93
     protected function _error($code, $message = null)
94 94
     {
95
-        if (!is_null($code) && !is_integer($code))
96
-            throw new \InvalidArgumentException("Invalid type given. Integer expected");
95
+        if (!is_null($code) && !is_integer($code)) {
96
+                    throw new \InvalidArgumentException("Invalid type given. Integer expected");
97
+        }
97 98
 
98
-        if (is_null($code))
99
-            $code = preg_replace('/=|\/|\+/', "", base64_encode($message));
100
-        else
99
+        if (is_null($code)) {
100
+                    $code = preg_replace('/=|\/|\+/', "", base64_encode($message));
101
+        } else
101 102
         {
102
-            if (!array_key_exists($code, $this->standardErrors) && empty($message))
103
-                /*
103
+            if (!array_key_exists($code, $this->standardErrors) && empty($message)) {
104
+                            /*
104 105
                  * "This kind of exception should lead directly to a fix in your code"
105 106
                  * Non-standard errors must have a message to describe the error, make sure
106 107
                  * you execute the error() method with a message as the second parameter.
@@ -108,16 +109,18 @@  discard block
 block discarded – undo
108 109
                  * Ref: http://php.net/manual/en/class.logicexception.php
109 110
                  */
110 111
                 throw new \LogicException('The message does not be empty in non-standard errors!');
112
+            }
111 113
         }
112 114
 
113
-        if (!array_key_exists($code, $this->errors))
114
-            $this->errors[$code] = (array_key_exists($code, $this->standardErrors))
115
+        if (!array_key_exists($code, $this->errors)) {
116
+                    $this->errors[$code] = (array_key_exists($code, $this->standardErrors))
115 117
                 ?
116 118
                     is_null($message)
117 119
                         ? preg_replace('/\s\'%[a-zA-Z]*%\'/', $message, $this->standardErrors[$code])
118 120
                         # if $message is not null it will replace the %file% wildcard
119 121
                         : preg_replace('/%[a-zA-Z]*%/', $message, $this->standardErrors[$code])
120 122
                 : $message;
123
+        }
121 124
     }
122 125
 
123 126
     function __call($method, $arguments)
@@ -127,10 +130,11 @@  discard block
 block discarded – undo
127 130
             switch (count($arguments))
128 131
             {
129 132
                 case 1:
130
-                    if (is_integer($arguments[0]))
131
-                        return call_user_func([$this, '_error'], array_shift($arguments));
132
-                    else
133
-                        return call_user_func([$this, '_error'], null, array_shift($arguments));
133
+                    if (is_integer($arguments[0])) {
134
+                                            return call_user_func([$this, '_error'], array_shift($arguments));
135
+                    } else {
136
+                                            return call_user_func([$this, '_error'], null, array_shift($arguments));
137
+                    }
134 138
                     break;
135 139
                 case 2:
136 140
                     return call_user_func([$this, '_error'], $arguments[0], $arguments[1]);
Please login to merge, or discard this patch.
test/Util/DateTimeTest.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,13 +39,11 @@
 block discarded – undo
39 39
         try
40 40
         {
41 41
             $this->assertEquals('June', Dt::getMonth(13));
42
-        }
43
-        catch (\Exception $e)
42
+        } catch (\Exception $e)
44 43
         {
45 44
             $errorObject = ($e instanceof MonthOutOfRange);
46 45
             $message = $e->getMessage();
47
-        }
48
-        finally
46
+        } finally
49 47
         {
50 48
             $this->assertTrue($errorObject, $message);
51 49
         }
Please login to merge, or discard this patch.