Passed
Branch master (800486)
by Darío
02:44
created
src/Db/Entity.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -109,11 +109,12 @@
 block discarded – undo
109 109
             {
110 110
                 $this->$prop = $value;
111 111
 
112
-                if (!in_array($prop, $this->changedFields))
113
-                    $this->changedFields[] = $prop;
112
+                if (!in_array($prop, $this->changedFields)) {
113
+                                    $this->changedFields[] = $prop;
114
+                }
115
+            } else {
116
+                            throw new \LogicException("The property '$prop' does not exists in the class '$class'");
114 117
             }
115
-            else
116
-                throw new \LogicException("The property '$prop' does not exists in the class '$class'");
117 118
         }
118 119
     }
119 120
 
Please login to merge, or discard this patch.
src/Db/Driver/AbstractDriver.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -298,8 +298,8 @@
 block discarded – undo
298 298
     {
299 299
         foreach ($options as $option => $value)
300 300
         {
301
-            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set'.$option))
302
-                $this->{'set'.$option}($value);
301
+            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set' . $option))
302
+                $this->{'set' . $option}($value);
303 303
         }
304 304
     }
305 305
 
Please login to merge, or discard this patch.
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -209,8 +209,9 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function getArrayResult()
211 211
     {
212
-        if (count($this->arrayResult))
213
-            return $this->arrayResult;
212
+        if (count($this->arrayResult)) {
213
+                    return $this->arrayResult;
214
+        }
214 215
 
215 216
         return $this->toArray();
216 217
     }
@@ -298,8 +299,9 @@  discard block
 block discarded – undo
298 299
     {
299 300
         foreach ($options as $option => $value)
300 301
         {
301
-            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set'.$option))
302
-                $this->{'set'.$option}($value);
302
+            if (property_exists(__CLASS__, strtolower($option)) && method_exists($this, 'set'.$option)) {
303
+                            $this->{'set'.$option}($value);
304
+            }
303 305
         }
304 306
     }
305 307
 
@@ -343,8 +345,9 @@  discard block
 block discarded – undo
343 345
      */
344 346
     public function reconnect()
345 347
     {
346
-        if (!$this->isConnected())
347
-            throw new \LogicException("Connection was not established");
348
+        if (!$this->isConnected()) {
349
+                    throw new \LogicException("Connection was not established");
350
+        }
348 351
 
349 352
         $this->disconnect();
350 353
         return $this->connect();
@@ -373,8 +376,9 @@  discard block
 block discarded – undo
373 376
      */
374 377
     public function disconnect()
375 378
     {
376
-        if (!$this->isConnected())
377
-            throw new \LogicException("Connection was not established");
379
+        if (!$this->isConnected()) {
380
+                    throw new \LogicException("Connection was not established");
381
+        }
378 382
     }
379 383
 
380 384
     /**
@@ -386,11 +390,13 @@  discard block
 block discarded – undo
386 390
      */
387 391
     public function beginTransaction()
388 392
     {
389
-        if (!$this->isConnected())
390
-            $this->connect();
393
+        if (!$this->isConnected()) {
394
+                    $this->connect();
395
+        }
391 396
 
392
-        if ($this->transac_mode)
393
-            throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_STARTED]);
397
+        if ($this->transac_mode) {
398
+                    throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_STARTED]);
399
+        }
394 400
 
395 401
         $this->transac_mode = true;
396 402
     }
@@ -404,16 +410,19 @@  discard block
 block discarded – undo
404 410
      */
405 411
     public function endTransaction()
406 412
     {
407
-        if (!$this->transac_mode)
408
-            throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_NOT_STARTED]);
413
+        if (!$this->transac_mode) {
414
+                    throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_NOT_STARTED]);
415
+        }
409 416
 
410
-        if (is_null($this->transac_result))
411
-            throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_EMPTY]);
417
+        if (is_null($this->transac_result)) {
418
+                    throw new \LogicException($this->standardErrors[Errno::DB_TRANSACTION_EMPTY]);
419
+        }
412 420
 
413
-        if ($this->transac_result)
414
-            $this->commit();
415
-        else
416
-            $this->rollback();
421
+        if ($this->transac_result) {
422
+                    $this->commit();
423
+        } else {
424
+                    $this->rollback();
425
+        }
417 426
 
418 427
         $this->result = $this->transac_result;
419 428
 
Please login to merge, or discard this patch.
src/Db/Driver/MySQL.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             {
109 109
                 if (is_string($param_values[$i]))
110 110
                     $bind_types .= 's';
111
-                else if(is_float($param_values[$i]))
111
+                else if (is_float($param_values[$i]))
112 112
                     $bind_types .= 'd';
113 113
                 # [POSSIBLE BUG] - To Future revision (What about non-string and non-decimal types ?)
114 114
                 else
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             $this->rowsAffected = $this->result->affected_rows;
165 165
 
166 166
         if ($this->transac_mode)
167
-            $this->transac_result = is_null($this->transac_result) ? $this->result: $this->transac_result && $this->result;
167
+            $this->transac_result = is_null($this->transac_result) ? $this->result : $this->transac_result && $this->result;
168 168
 
169 169
         return $this->result;
170 170
     }
Please login to merge, or discard this patch.
Braces   +46 added lines, -35 removed lines patch added patch discarded remove patch
@@ -24,15 +24,17 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function __construct($options)
26 26
     {
27
-        if (!array_key_exists("dbchar", $options))
28
-            $options["dbchar"] = "utf8";
27
+        if (!array_key_exists("dbchar", $options)) {
28
+                    $options["dbchar"] = "utf8";
29
+        }
29 30
 
30 31
         parent::__construct($options);
31 32
 
32 33
         $auto_connect = array_key_exists('auto_connect', $options) ? $options["auto_connect"] : true;
33 34
 
34
-        if ($auto_connect)
35
-            $this->connect();
35
+        if ($auto_connect) {
36
+                    $this->connect();
37
+        }
36 38
     }
37 39
 
38 40
     /**
@@ -45,13 +47,15 @@  discard block
 block discarded – undo
45 47
      */
46 48
     public function connect()
47 49
     {
48
-        if (!extension_loaded('mysqli'))
49
-            throw new \RuntimeException("The Mysqli extension is not loaded");
50
+        if (!extension_loaded('mysqli')) {
51
+                    throw new \RuntimeException("The Mysqli extension is not loaded");
52
+        }
50 53
 
51
-        if (!is_null($this->dbport) && !empty($this->dbport))
52
-            $this->dbconn = @new \mysqli($this->dbhost, $this->dbuser, $this->dbpass, $this->dbname, $this->dbport);
53
-        else
54
-            $this->dbconn = @new \mysqli($this->dbhost, $this->dbuser, $this->dbpass, $this->dbname);
54
+        if (!is_null($this->dbport) && !empty($this->dbport)) {
55
+                    $this->dbconn = @new \mysqli($this->dbhost, $this->dbuser, $this->dbpass, $this->dbname, $this->dbport);
56
+        } else {
57
+                    $this->dbconn = @new \mysqli($this->dbhost, $this->dbuser, $this->dbpass, $this->dbname);
58
+        }
55 59
 
56 60
         if ($this->dbconn->connect_errno)
57 61
         {
@@ -61,9 +65,9 @@  discard block
 block discarded – undo
61 65
              * the warning message "Property access is not allowed yet".
62 66
              */
63 67
             throw new Exception\ConnectionException(mysqli_connect_error(), mysqli_connect_errno());
68
+        } else {
69
+                    $this->dbconn->set_charset($this->dbchar);
64 70
         }
65
-        else
66
-            $this->dbconn->set_charset($this->dbchar);
67 71
 
68 72
         return $this->dbconn;
69 73
     }
@@ -106,13 +110,15 @@  discard block
 block discarded – undo
106 110
 
107 111
             for ($i = 0; $i < $n_params; $i++)
108 112
             {
109
-                if (is_string($param_values[$i]))
110
-                    $bind_types .= 's';
111
-                else if(is_float($param_values[$i]))
112
-                    $bind_types .= 'd';
113
+                if (is_string($param_values[$i])) {
114
+                                    $bind_types .= 's';
115
+                } else if(is_float($param_values[$i])) {
116
+                                    $bind_types .= 'd';
117
+                }
113 118
                 # [POSSIBLE BUG] - To Future revision (What about non-string and non-decimal types ?)
114
-                else
115
-                    $bind_types .= 's';
119
+                else {
120
+                                    $bind_types .= 's';
121
+                }
116 122
 
117 123
                 $bind_values[] = '$param_values[' . $i . ']';
118 124
             }
@@ -133,12 +139,12 @@  discard block
 block discarded – undo
133 139
                      * It is useful to prevent rollback transactions on insert statements because
134 140
                      * insert statement do not free results.
135 141
                      */
136
-                    if ($res)
137
-                        $this->result = $res;
142
+                    if ($res) {
143
+                                            $this->result = $res;
144
+                    }
138 145
                 }
139 146
             }
140
-        }
141
-        else
147
+        } else
142 148
         {
143 149
             $prev_error_handler = set_error_handler(['\Drone\Error\ErrorHandler', 'errorControlOperator'], E_ALL);
144 150
 
@@ -154,17 +160,21 @@  discard block
 block discarded – undo
154 160
             throw new Exception\InvalidQueryException($this->dbconn->error, $this->dbconn->errno);
155 161
         }
156 162
 
157
-        if (is_object($this->result) && property_exists($this->result, 'num_rows'))
158
-            $this->numRows = $this->result->num_rows;
163
+        if (is_object($this->result) && property_exists($this->result, 'num_rows')) {
164
+                    $this->numRows = $this->result->num_rows;
165
+        }
159 166
 
160
-        if (is_object($this->result) && property_exists($this->result, 'field_count'))
161
-            $this->numFields = $this->result->field_count;
167
+        if (is_object($this->result) && property_exists($this->result, 'field_count')) {
168
+                    $this->numFields = $this->result->field_count;
169
+        }
162 170
 
163
-        if (is_object($this->result) && property_exists($this->result, 'affected_rows'))
164
-            $this->rowsAffected = $this->result->affected_rows;
171
+        if (is_object($this->result) && property_exists($this->result, 'affected_rows')) {
172
+                    $this->rowsAffected = $this->result->affected_rows;
173
+        }
165 174
 
166
-        if ($this->transac_mode)
167
-            $this->transac_result = is_null($this->transac_result) ? $this->result: $this->transac_result && $this->result;
175
+        if ($this->transac_mode) {
176
+                    $this->transac_result = is_null($this->transac_result) ? $this->result: $this->transac_result && $this->result;
177
+        }
168 178
 
169 179
         return $this->result;
170 180
     }
@@ -220,9 +230,8 @@  discard block
 block discarded – undo
220 230
             {
221 231
                 $data[] = $row;
222 232
             }
223
-        }
224
-        else
225
-            /*
233
+        } else {
234
+                    /*
226 235
              * "This kind of exception should lead directly to a fix in your code"
227 236
              * So much production tests tell us this error is throwed because developers
228 237
              * execute toArray() before execute().
@@ -230,6 +239,7 @@  discard block
 block discarded – undo
230 239
              * Ref: http://php.net/manual/en/class.logicexception.php
231 240
              */
232 241
             throw new \LogicException('There are not data in the buffer!');
242
+        }
233 243
 
234 244
         $this->arrayResult = $data;
235 245
 
@@ -244,7 +254,8 @@  discard block
 block discarded – undo
244 254
     public function __destruct()
245 255
     {
246 256
         # prevent "Property access is not allowed yet" with @ on failure connections
247
-        if ($this->dbconn !== false && !is_null($this->dbconn))
248
-            @$this->dbconn->close();
257
+        if ($this->dbconn !== false && !is_null($this->dbconn)) {
258
+                    @$this->dbconn->close();
259
+        }
249 260
     }
250 261
 }
251 262
\ No newline at end of file
Please login to merge, or discard this patch.
src/Db/Driver/Oracle.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
             ? $this->dbname
53 53
             :
54 54
                 (!is_null($this->dbport) && !empty($this->dbport))
55
-                    ? $this->dbhost .":". $this->dbport ."/". $this->dbname
56
-                    : $this->dbhost ."/". $this->dbname;
55
+                    ? $this->dbhost . ":" . $this->dbport . "/" . $this->dbname
56
+                    : $this->dbhost . "/" . $this->dbname;
57 57
 
58
-        $this->dbconn = @oci_connect($this->dbuser,  $this->dbpass, $connection_string, $this->dbchar);
58
+        $this->dbconn = @oci_connect($this->dbuser, $this->dbpass, $connection_string, $this->dbchar);
59 59
 
60 60
         if ($this->dbconn === false)
61 61
         {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $prev_error_handler = set_error_handler(['\Drone\Error\ErrorHandler', 'errorControlOperator'], E_ALL);
123 123
 
124 124
         // may be throw a Fatal error (Ex: Maximum execution time)
125
-        $r = ($this->transac_mode) ? oci_execute($stid, OCI_NO_AUTO_COMMIT) : oci_execute($stid,  OCI_COMMIT_ON_SUCCESS);
125
+        $r = ($this->transac_mode) ? oci_execute($stid, OCI_NO_AUTO_COMMIT) : oci_execute($stid, OCI_COMMIT_ON_SUCCESS);
126 126
 
127 127
         set_error_handler($prev_error_handler);
128 128
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         $this->numFields = oci_num_fields($stid);
144 144
 
145 145
         if ($this->transac_mode)
146
-            $this->transac_result = is_null($this->transac_result) ? $this->result: $this->transac_result && $this->result;
146
+            $this->transac_result = is_null($this->transac_result) ? $this->result : $this->transac_result && $this->result;
147 147
 
148 148
         return $this->result;
149 149
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         if ($this->result)
188 188
         {
189
-            while ( ($row = @oci_fetch_array($this->result, OCI_BOTH + OCI_RETURN_NULLS)) !== false )
189
+            while (($row = @oci_fetch_array($this->result, OCI_BOTH + OCI_RETURN_NULLS)) !== false)
190 190
             {
191 191
                 $data[] = $row;
192 192
             }
Please login to merge, or discard this patch.
Braces   +25 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,15 +24,17 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function __construct($options)
26 26
     {
27
-        if (!array_key_exists("dbchar", $options))
28
-            $options["dbchar"] = "AL32UTF8";
27
+        if (!array_key_exists("dbchar", $options)) {
28
+                    $options["dbchar"] = "AL32UTF8";
29
+        }
29 30
 
30 31
         parent::__construct($options);
31 32
 
32 33
         $auto_connect = array_key_exists('auto_connect', $options) ? $options["auto_connect"] : true;
33 34
 
34
-        if ($auto_connect)
35
-            $this->connect();
35
+        if ($auto_connect) {
36
+                    $this->connect();
37
+        }
36 38
     }
37 39
 
38 40
     /**
@@ -45,8 +47,9 @@  discard block
 block discarded – undo
45 47
      */
46 48
     public function connect()
47 49
     {
48
-        if (!extension_loaded('oci8'))
49
-            throw new \RuntimeException("The Oci8 extension is not loaded");
50
+        if (!extension_loaded('oci8')) {
51
+                    throw new \RuntimeException("The Oci8 extension is not loaded");
52
+        }
50 53
 
51 54
         $connection_string = (is_null($this->dbhost) || empty($this->dbhost))
52 55
             ? $this->dbname
@@ -97,14 +100,15 @@  discard block
 block discarded – undo
97 100
                 ];
98 101
 
99 102
                 $this->error($error["message"]);
103
+            } else {
104
+                            $this->error($error["code"], $error["message"]);
100 105
             }
101
-            else
102
-                $this->error($error["code"], $error["message"]);
103 106
 
104
-            if (array_key_exists("code", $error))
105
-                throw new Exception\InvalidQueryException($error["message"], $error["code"]);
106
-            else
107
-                throw new Exception\InvalidQueryException($error["message"]);
107
+            if (array_key_exists("code", $error)) {
108
+                            throw new Exception\InvalidQueryException($error["message"], $error["code"]);
109
+            } else {
110
+                            throw new Exception\InvalidQueryException($error["message"]);
111
+            }
108 112
         }
109 113
 
110 114
         # Bound variables
@@ -142,8 +146,9 @@  discard block
 block discarded – undo
142 146
         $this->numRows = count($rows);
143 147
         $this->numFields = oci_num_fields($stid);
144 148
 
145
-        if ($this->transac_mode)
146
-            $this->transac_result = is_null($this->transac_result) ? $this->result: $this->transac_result && $this->result;
149
+        if ($this->transac_mode) {
150
+                    $this->transac_result = is_null($this->transac_result) ? $this->result: $this->transac_result && $this->result;
151
+        }
147 152
 
148 153
         return $this->result;
149 154
     }
@@ -190,9 +195,8 @@  discard block
 block discarded – undo
190 195
             {
191 196
                 $data[] = $row;
192 197
             }
193
-        }
194
-        else
195
-            /*
198
+        } else {
199
+                    /*
196 200
              * "This kind of exception should lead directly to a fix in your code"
197 201
              * So much production tests tell us this error is throwed because developers
198 202
              * execute toArray() before execute().
@@ -200,6 +204,7 @@  discard block
 block discarded – undo
200 204
              * Ref: http://php.net/manual/en/class.logicexception.php
201 205
              */
202 206
             throw new \LogicException('There are not data in the buffer!');
207
+        }
203 208
 
204 209
         $this->arrayResult = $data;
205 210
 
@@ -213,7 +218,8 @@  discard block
 block discarded – undo
213 218
      */
214 219
     public function __destruct()
215 220
     {
216
-        if ($this->dbconn)
217
-            oci_close($this->dbconn);
221
+        if ($this->dbconn) {
222
+                    oci_close($this->dbconn);
223
+        }
218 224
     }
219 225
 }
220 226
\ No newline at end of file
Please login to merge, or discard this patch.
src/Db/Driver/DriverAdapter.php 1 patch
Braces   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -85,13 +85,14 @@  discard block
 block discarded – undo
85 85
             "Sqlsrv" => "Drone\Db\Driver\SQLServer",
86 86
         ];
87 87
 
88
-        if (gettype($connection_identifier) == 'array')
89
-            $connection_array = $connection_identifier;
90
-        else
88
+        if (gettype($connection_identifier) == 'array') {
89
+                    $connection_array = $connection_identifier;
90
+        } else
91 91
         {
92 92
             # Take connection parameters from configuration file
93
-            if (!file_exists("config/database.config.php"))
94
-                throw new \RuntimeException("config/data.base.config.php is missing!");
93
+            if (!file_exists("config/database.config.php")) {
94
+                            throw new \RuntimeException("config/data.base.config.php is missing!");
95
+            }
95 96
 
96 97
             $dbsettings = include("config/database.config.php");
97 98
             $connection_array = $dbsettings[$connection_identifier];
@@ -106,8 +107,8 @@  discard block
 block discarded – undo
106 107
 
107 108
             $this->driverName = $drv;
108 109
             $this->db = new $driver[$drv]($connection_array);
110
+        } else {
111
+                    throw new \RuntimeException("The Database driver does not exists");
109 112
         }
110
-        else
111
-            throw new \RuntimeException("The Database driver does not exists");
112 113
     }
113 114
 }
114 115
\ No newline at end of file
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/TableGatewayInterface.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
      *
23 23
      * @param array $where
24 24
      */
25
-	public function select(Array $where);
25
+    public function select(Array $where);
26 26
 
27 27
     /**
28 28
      * Insert statement
29 29
      *
30 30
      * @param array $data
31 31
      */
32
-	public function insert(Array $data);
32
+    public function insert(Array $data);
33 33
 
34 34
     /**
35 35
      * Update statement
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
      * @param array $set
38 38
      * @param array $where
39 39
      */
40
-	public function update(Array $set, Array $where);
40
+    public function update(Array $set, Array $where);
41 41
 
42 42
     /**
43 43
      * Delete statement
44 44
      *
45 45
      * @param array $where
46 46
      */
47
-	public function delete(Array $where);
47
+    public function delete(Array $where);
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
src/Db/TableGateway/AbstractTableGateway.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,8 @@
 block discarded – undo
73 73
     {
74 74
         $this->currentDriverIdentifier = $connection_identifier;
75 75
 
76
-        if (!isset(self::$drivers[$connection_identifier]))
77
-            self::$drivers[$connection_identifier] = new DriverAdapter($connection_identifier, $auto_connect);
76
+        if (!isset(self::$drivers[$connection_identifier])) {
77
+                    self::$drivers[$connection_identifier] = new DriverAdapter($connection_identifier, $auto_connect);
78
+        }
78 79
     }
79 80
 }
80 81
\ No newline at end of file
Please login to merge, or discard this patch.
src/Db/TableGateway/TableGateway.php 1 patch
Braces   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
             {
74 74
                 $k++;
75 75
 
76
-                if (is_null($value))
77
-                    $parsed_where[] = "$key IS NULL";
78
-                elseif ($value instanceof SQLFunction)
79
-                    $parsed_where[] = "$key = " . $value->getStatement();
80
-                elseif (is_array($value))
76
+                if (is_null($value)) {
77
+                                    $parsed_where[] = "$key IS NULL";
78
+                } elseif ($value instanceof SQLFunction) {
79
+                                    $parsed_where[] = "$key = " . $value->getStatement();
80
+                } elseif (is_array($value))
81 81
                 {
82 82
                     $parsed_in = [];
83 83
 
@@ -100,8 +100,7 @@  discard block
 block discarded – undo
100 100
                     }
101 101
 
102 102
                     $parsed_where[] = "$key IN (" . implode(", ", $parsed_in) . ")";
103
-                }
104
-                else
103
+                } else
105 104
                 {
106 105
                     switch ($driver)
107 106
                     {
@@ -119,9 +118,9 @@  discard block
 block discarded – undo
119 118
             }
120 119
 
121 120
             $where = "WHERE \r\n\t" . implode(" AND\r\n\t", $parsed_where);
121
+        } else {
122
+                    $where = "";
122 123
         }
123
-        else
124
-            $where = "";
125 124
 
126 125
         $table = $this->entity->getTableName();
127 126
 
@@ -144,8 +143,9 @@  discard block
 block discarded – undo
144 143
      */
145 144
     public function insert(Array $data)
146 145
     {
147
-        if (!count($data))
148
-            throw new \LogicException("Missing values for INSERT statement!");
146
+        if (!count($data)) {
147
+                    throw new \LogicException("Missing values for INSERT statement!");
148
+        }
149 149
 
150 150
         $bind_values = [];
151 151
 
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
                 continue;
169 169
             }
170 170
 
171
-            if (is_null($value))
172
-                $value = "NULL";
173
-            elseif ($value instanceof SQLFunction)
174
-                $value = $value->getStatement();
175
-            else {
171
+            if (is_null($value)) {
172
+                            $value = "NULL";
173
+            } elseif ($value instanceof SQLFunction) {
174
+                            $value = $value->getStatement();
175
+            } else {
176 176
 
177 177
                 switch ($driver)
178 178
                 {
@@ -222,11 +222,13 @@  discard block
 block discarded – undo
222 222
     {
223 223
         $parsed_set = [];
224 224
 
225
-        if (!count($set))
226
-            throw new \LogicException("You cannot update rows without SET clause");
225
+        if (!count($set)) {
226
+                    throw new \LogicException("You cannot update rows without SET clause");
227
+        }
227 228
 
228
-        if (!count($where))
229
-            throw new SecurityException("You cannot update rows without WHERE clause!");
229
+        if (!count($where)) {
230
+                    throw new SecurityException("You cannot update rows without WHERE clause!");
231
+        }
230 232
 
231 233
         $bind_values = [];
232 234
 
@@ -238,11 +240,11 @@  discard block
 block discarded – undo
238 240
         {
239 241
             $k++;
240 242
 
241
-            if (is_null($value))
242
-                $parsed_set[] = "$key = NULL";
243
-            elseif ($value instanceof SQLFunction)
244
-                $parsed_set[] = "$key = " . $value->getStatement();
245
-            elseif (is_array($value))
243
+            if (is_null($value)) {
244
+                            $parsed_set[] = "$key = NULL";
245
+            } elseif ($value instanceof SQLFunction) {
246
+                            $parsed_set[] = "$key = " . $value->getStatement();
247
+            } elseif (is_array($value))
246 248
             {
247 249
                 $parsed_in = [];
248 250
 
@@ -253,8 +255,9 @@  discard block
 block discarded – undo
253 255
                         case 'Oci8':
254 256
 
255 257
                             # [POSSIBLE BUG] - To Future revision (What about non-string values ?)
256
-                            if (is_string($in_value))
257
-                                $parsed_in[] = ":$k";
258
+                            if (is_string($in_value)) {
259
+                                                            $parsed_in[] = ":$k";
260
+                            }
258 261
 
259 262
                             $bind_values[":$k"] = $in_value;
260 263
                             break;
@@ -269,8 +272,7 @@  discard block
 block discarded – undo
269 272
                 }
270 273
 
271 274
                 $parsed_set[] = "$key IN (" . implode(", ", $parsed_in) . ")";
272
-            }
273
-            else
275
+            } else
274 276
             {
275 277
                 switch ($driver)
276 278
                 {
@@ -296,11 +298,11 @@  discard block
 block discarded – undo
296 298
         {
297 299
             $k++;
298 300
 
299
-            if (is_null($value))
300
-                $parsed_where[] = "$key IS NULL";
301
-            elseif ($value instanceof SQLFunction)
302
-                $parsed_where[] = "$key = " . $value->getStatement();
303
-            elseif (is_array($value))
301
+            if (is_null($value)) {
302
+                            $parsed_where[] = "$key IS NULL";
303
+            } elseif ($value instanceof SQLFunction) {
304
+                            $parsed_where[] = "$key = " . $value->getStatement();
305
+            } elseif (is_array($value))
304 306
             {
305 307
                 $parsed_in = [];
306 308
 
@@ -323,8 +325,7 @@  discard block
 block discarded – undo
323 325
                 }
324 326
 
325 327
                 $parsed_where[] = "$key IN (" . implode(", ", $parsed_in) . ")";
326
-            }
327
-            else
328
+            } else
328 329
             {
329 330
                 switch ($driver)
330 331
                 {
@@ -376,11 +377,11 @@  discard block
 block discarded – undo
376 377
             {
377 378
                 $k++;
378 379
 
379
-                if (is_null($value))
380
-                    $parsed_where[] = "$key IS NULL";
381
-                elseif ($value instanceof SQLFunction)
382
-                    $parsed_where[] = "$key = " . $value->getStatement();
383
-                elseif (is_array($value))
380
+                if (is_null($value)) {
381
+                                    $parsed_where[] = "$key IS NULL";
382
+                } elseif ($value instanceof SQLFunction) {
383
+                                    $parsed_where[] = "$key = " . $value->getStatement();
384
+                } elseif (is_array($value))
384 385
                 {
385 386
                     $parsed_in = [];
386 387
 
@@ -403,8 +404,7 @@  discard block
 block discarded – undo
403 404
                     }
404 405
 
405 406
                     $parsed_where[] = "$key IN (" . implode(", ", $parsed_in) . ")";
406
-                }
407
-                else
407
+                } else
408 408
                 {
409 409
                     switch ($driver)
410 410
                     {
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
             }
423 423
 
424 424
             $where = "\r\nWHERE \r\n\t" . implode(" AND\r\n\t", $parsed_where);
425
+        } else {
426
+                    throw new SecurityException("You cannot delete rows without WHERE clause!. Use TRUNCATE statement instead.");
425 427
         }
426
-        else
427
-            throw new SecurityException("You cannot delete rows without WHERE clause!. Use TRUNCATE statement instead.");
428 428
 
429 429
         $table = $this->entity->getTableName();
430 430
 
Please login to merge, or discard this patch.