Passed
Push — master ( 2d92e4...0d56ed )
by Darío
01:37
created
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 1 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.