Test Failed
Push — master ( e40771...7e26c1 )
by Darío
02:10
created
src/Network/Rest/AbstractRest.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,8 +127,9 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function setWhiteList(array $whiteList)
129 129
     {
130
-        if (empty($whiteList))
131
-            throw new \RuntimeException("Empty whitelist!");
130
+        if (empty($whiteList)) {
131
+                    throw new \RuntimeException("Empty whitelist!");
132
+        }
132 133
 
133 134
         $this->whiteList = $whiteList;
134 135
     }
@@ -156,8 +157,9 @@  discard block
 block discarded – undo
156 157
     {
157 158
         foreach ($options as $option => $value)
158 159
         {
159
-            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set'.$option))
160
-            $this->{'set'.$option}($value);
160
+            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set'.$option)) {
161
+                        $this->{'set'.$option}($value);
162
+            }
161 163
         }
162 164
 
163 165
         # HTTP instance
Please login to merge, or discard this patch.
src/Network/Server.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,11 +64,13 @@
 block discarded – undo
64 64
      */
65 65
     public static function getClientIP()
66 66
     {
67
-        if (!empty($_SERVER['HTTP_CLIENT_IP']))
68
-            return $_SERVER['HTTP_CLIENT_IP'];
67
+        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
68
+                    return $_SERVER['HTTP_CLIENT_IP'];
69
+        }
69 70
 
70
-        if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
71
-            return $_SERVER['HTTP_X_FORWARDED_FOR'];
71
+        if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
72
+                    return $_SERVER['HTTP_X_FORWARDED_FOR'];
73
+        }
72 74
 
73 75
         return $_SERVER['REMOTE_ADDR'];
74 76
     }
Please login to merge, or discard this patch.
src/Util/ParamTrait.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,9 @@
 block discarded – undo
70 70
     {
71 71
         $parameters = $this->getParams();
72 72
 
73
-        if (array_key_exists($param, $parameters))
74
-            return true;
73
+        if (array_key_exists($param, $parameters)) {
74
+                    return true;
75
+        }
75 76
 
76 77
         return false;
77 78
     }
Please login to merge, or discard this patch.
src/Db/SQLFunction.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,8 +77,9 @@
 block discarded – undo
77 77
 
78 78
         foreach ($arguments as $key => $arg)
79 79
         {
80
-            if (is_string($arg))
81
-                $arguments[$key] = "'$arg'";
80
+            if (is_string($arg)) {
81
+                            $arguments[$key] = "'$arg'";
82
+            }
82 83
         }
83 84
 
84 85
         $arguments = implode(", ", array_values($arguments));
Please login to merge, or discard this patch.
src/Db/TableGateway/EntityAdapter.php 1 patch
Braces   +21 added lines, -16 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $result = $this->tableGateway->select($where);
60 60
 
61
-        if (!count($result))
62
-            return $result;
61
+        if (!count($result)) {
62
+                    return $result;
63
+        }
63 64
 
64 65
         $array_result = [];
65 66
 
@@ -69,8 +70,9 @@  discard block
 block discarded – undo
69 70
 
70 71
             foreach ($row as $key => $value)
71 72
             {
72
-                if (is_string($key))
73
-                    $filtered_array[$key] = $value;
73
+                if (is_string($key)) {
74
+                                    $filtered_array[$key] = $value;
75
+                }
74 76
             }
75 77
 
76 78
             $user_entity = get_class($this->tableGateway->getEntity());
@@ -94,10 +96,11 @@  discard block
 block discarded – undo
94 96
      */
95 97
     public function insert($entity)
96 98
     {
97
-        if ($entity instanceof Entity)
98
-            $entity = get_object_vars($entity);
99
-        else if (!is_array($entity))
100
-            throw new \InvalidArgumentException("Invalid type given. Drone\Db\Entity or Array expected");
99
+        if ($entity instanceof Entity) {
100
+                    $entity = get_object_vars($entity);
101
+        } else if (!is_array($entity)) {
102
+                    throw new \InvalidArgumentException("Invalid type given. Drone\Db\Entity or Array expected");
103
+        }
101 104
 
102 105
         $this->parseEntity($entity);
103 106
 
@@ -126,14 +129,15 @@  discard block
 block discarded – undo
126 129
 
127 130
             foreach ($entity as $key => $value)
128 131
             {
129
-                if (in_array($key, $changedFields))
130
-                    $fieldsToModify[$key] = $value;
132
+                if (in_array($key, $changedFields)) {
133
+                                    $fieldsToModify[$key] = $value;
134
+                }
131 135
             }
132 136
 
133 137
             $entity = $fieldsToModify;
138
+        } else if (!is_array($entity)) {
139
+                    throw new \InvalidArgumentException("Invalid type given. Drone\Db\Entity or Array expected");
134 140
         }
135
-        else if (!is_array($entity))
136
-            throw new \InvalidArgumentException("Invalid type given. Drone\Db\Entity or Array expected");
137 141
 
138 142
         $this->parseEntity($entity);
139 143
 
@@ -152,10 +156,11 @@  discard block
 block discarded – undo
152 156
      */
153 157
     public function delete($entity)
154 158
     {
155
-        if ($entity instanceof Entity)
156
-            $entity = get_object_vars($entity);
157
-        else if (!is_array($entity))
158
-            throw new \InvalidArgumentException("Invalid type given. Drone\Db\Entity or Array expected");
159
+        if ($entity instanceof Entity) {
160
+                    $entity = get_object_vars($entity);
161
+        } else if (!is_array($entity)) {
162
+                    throw new \InvalidArgumentException("Invalid type given. Drone\Db\Entity or Array expected");
163
+        }
159 164
 
160 165
         return $this->tableGateway->delete($entity);
161 166
     }
Please login to merge, or discard this patch.
src/Pear/Mail.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -74,18 +74,21 @@  discard block
 block discarded – undo
74 74
     {
75 75
         @include_once 'System.php';
76 76
 
77
-        if (!class_exists('System', false))
78
-            throw new \RuntimeException("PEAR is not installed in your system!");
77
+        if (!class_exists('System', false)) {
78
+                    throw new \RuntimeException("PEAR is not installed in your system!");
79
+        }
79 80
 
80 81
         include_once 'Net/SMTP.php';
81 82
 
82
-        if (!class_exists('\Net_SMTP', false))
83
-            throw new \RuntimeException("PEAR::Net_SMTP is not installed!");
83
+        if (!class_exists('\Net_SMTP', false)) {
84
+                    throw new \RuntimeException("PEAR::Net_SMTP is not installed!");
85
+        }
84 86
 
85 87
         @include_once 'Mail.php';
86 88
 
87
-        if (!class_exists('\Mail', false))
88
-            throw new \RuntimeException("PEAR::Mail is not installed!");
89
+        if (!class_exists('\Mail', false)) {
90
+                    throw new \RuntimeException("PEAR::Mail is not installed!");
91
+        }
89 92
     }
90 93
 
91 94
     /**
@@ -98,8 +101,9 @@  discard block
 block discarded – undo
98 101
      */
99 102
     protected function error($code, $message = null)
100 103
     {
101
-        if (!array_key_exists($code, $this->errors))
102
-            $this->errors[$message] = (is_null($message) && array_key_exists($code, $this->errors)) ? $this->errors[$code] : $message;
104
+        if (!array_key_exists($code, $this->errors)) {
105
+                    $this->errors[$message] = (is_null($message) && array_key_exists($code, $this->errors)) ? $this->errors[$code] : $message;
106
+        }
103 107
     }
104 108
 
105 109
     /**
Please login to merge, or discard this patch.
src/Network/Socket/AbstractSocket.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,8 +108,9 @@
 block discarded – undo
108 108
     {
109 109
         foreach ($options as $option => $value)
110 110
         {
111
-            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set'.$option))
112
-            $this->{'set'.$option}($value);
111
+            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set'.$option)) {
112
+                        $this->{'set'.$option}($value);
113
+            }
113 114
         }
114 115
 
115 116
         if (!($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP)))
Please login to merge, or discard this patch.
src/Db/Entity.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -107,11 +107,12 @@
 block discarded – undo
107 107
             {
108 108
                 $this->$prop = $value;
109 109
 
110
-                if (!in_array($prop, $this->changedFields))
111
-                    $this->changedFields[] = $prop;
110
+                if (!in_array($prop, $this->changedFields)) {
111
+                                    $this->changedFields[] = $prop;
112
+                }
113
+            } else {
114
+                            throw new \LogicException("The property '$prop' does not exists in the class ' " . get_class($this) . " '");
112 115
             }
113
-            else
114
-                throw new \LogicException("The property '$prop' does not exists in the class ' " . get_class($this) . " '");
115 116
         }
116 117
     }
117 118
 
Please login to merge, or discard this patch.
src/Db/Driver/AbstractDriver.php 1 patch
Braces   +32 added lines, -22 removed lines patch added patch discarded remove patch
@@ -216,8 +216,9 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public function getArrayResult()
218 218
     {
219
-        if (!empty($this->arrayResult))
220
-            return $this->arrayResult;
219
+        if (!empty($this->arrayResult)) {
220
+                    return $this->arrayResult;
221
+        }
221 222
 
222 223
         return $this->toArray();
223 224
     }
@@ -313,8 +314,9 @@  discard block
 block discarded – undo
313 314
      */
314 315
     public function autocommit($value)
315 316
     {
316
-        if ($this->transac_mode)
317
-            throw new \LogicException("You cannot change autocommit behavior during a transaction");
317
+        if ($this->transac_mode) {
318
+                    throw new \LogicException("You cannot change autocommit behavior during a transaction");
319
+        }
318 320
 
319 321
         $this->autocommit = $value;
320 322
     }
@@ -330,8 +332,9 @@  discard block
 block discarded – undo
330 332
     {
331 333
         foreach ($options as $option => $value)
332 334
         {
333
-            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set'.$option))
334
-                $this->{'set'.$option}($value);
335
+            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set'.$option)) {
336
+                            $this->{'set'.$option}($value);
337
+            }
335 338
         }
336 339
     }
337 340
 
@@ -375,8 +378,9 @@  discard block
 block discarded – undo
375 378
      */
376 379
     public function reconnect()
377 380
     {
378
-        if (!$this->isConnected())
379
-            throw new \LogicException("Connection was not established");
381
+        if (!$this->isConnected()) {
382
+                    throw new \LogicException("Connection was not established");
383
+        }
380 384
 
381 385
         $this->disconnect();
382 386
         return $this->connect();
@@ -405,8 +409,9 @@  discard block
 block discarded – undo
405 409
      */
406 410
     public function disconnect()
407 411
     {
408
-        if (!$this->isConnected())
409
-            throw new \LogicException("Connection was not established");
412
+        if (!$this->isConnected()) {
413
+                    throw new \LogicException("Connection was not established");
414
+        }
410 415
     }
411 416
 
412 417
     /**
@@ -418,11 +423,13 @@  discard block
 block discarded – undo
418 423
      */
419 424
     public function beginTransaction()
420 425
     {
421
-        if (!$this->isConnected())
422
-            $this->connect();
426
+        if (!$this->isConnected()) {
427
+                    $this->connect();
428
+        }
423 429
 
424
-        if ($this->transac_mode)
425
-            throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_STARTED]);
430
+        if ($this->transac_mode) {
431
+                    throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_STARTED]);
432
+        }
426 433
 
427 434
         $this->transac_mode = true;
428 435
     }
@@ -436,16 +443,19 @@  discard block
 block discarded – undo
436 443
      */
437 444
     public function endTransaction()
438 445
     {
439
-        if (!$this->transac_mode)
440
-            throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_NOT_STARTED]);
446
+        if (!$this->transac_mode) {
447
+                    throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_NOT_STARTED]);
448
+        }
441 449
 
442
-        if (is_null($this->transac_result))
443
-            throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_EMPTY]);
450
+        if (is_null($this->transac_result)) {
451
+                    throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_EMPTY]);
452
+        }
444 453
 
445
-        if ($this->transac_result)
446
-            $this->commit();
447
-        else
448
-            $this->rollback();
454
+        if ($this->transac_result) {
455
+                    $this->commit();
456
+        } else {
457
+                    $this->rollback();
458
+        }
449 459
 
450 460
         $this->result = $this->transac_result;
451 461
 
Please login to merge, or discard this patch.