@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | { |
165 | 165 | foreach ($params as $param => $value) |
166 | 166 | { |
167 | - if (property_exists(__CLASS__, strtolower($param)) && method_exists($this, 'set'.$param)) |
|
168 | - $this->{'set'.$param}($value); |
|
167 | + if (property_exists(__CLASS__, strtolower($param)) && method_exists($this, 'set' . $param)) |
|
168 | + $this->{'set' . $param}($value); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | |
186 | 186 | if ($controller->getShowView()) |
187 | 187 | { |
188 | - $view = 'module/' . $controller->getModule()->getModuleName() . |
|
189 | - '/source/view/'. basename(str_replace('\\','/',get_class($controller))) . |
|
190 | - '/' . $controller->getMethod() . '.phtml'; |
|
188 | + $view = 'module/' . $controller->getModule()->getModuleName() . |
|
189 | + '/source/view/' . basename(str_replace('\\', '/', get_class($controller))) . |
|
190 | + '/' . $controller->getMethod() . '.phtml'; |
|
191 | 191 | |
192 | 192 | $this->view = $view; |
193 | 193 | } |
@@ -133,8 +133,9 @@ discard block |
||
133 | 133 | { |
134 | 134 | $config = $module->getConfig(); |
135 | 135 | |
136 | - if (!array_key_exists($view, $config["view_manager"]["view_map"]) || !file_exists($config["view_manager"]["view_map"][$view])) |
|
137 | - throw new Exception\ViewNotFoundException("The 'view' template " . $view . " does not exists"); |
|
136 | + if (!array_key_exists($view, $config["view_manager"]["view_map"]) || !file_exists($config["view_manager"]["view_map"][$view])) { |
|
137 | + throw new Exception\ViewNotFoundException("The 'view' template " . $view . " does not exists"); |
|
138 | + } |
|
138 | 139 | |
139 | 140 | $this->view = $config["view_manager"]["view_map"][$view]; |
140 | 141 | } |
@@ -164,8 +165,9 @@ discard block |
||
164 | 165 | { |
165 | 166 | foreach ($params as $param => $value) |
166 | 167 | { |
167 | - if (property_exists(__CLASS__, strtolower($param)) && method_exists($this, 'set'.$param)) |
|
168 | - $this->{'set'.$param}($value); |
|
168 | + if (property_exists(__CLASS__, strtolower($param)) && method_exists($this, 'set'.$param)) { |
|
169 | + $this->{'set'.$param}($value); |
|
170 | + } |
|
169 | 171 | } |
170 | 172 | } |
171 | 173 | |
@@ -194,23 +196,26 @@ discard block |
||
194 | 196 | |
195 | 197 | if ($controller->getTerminal()) |
196 | 198 | { |
197 | - if (file_exists($view)) |
|
198 | - include $view; |
|
199 | - } |
|
200 | - else |
|
199 | + if (file_exists($view)) { |
|
200 | + include $view; |
|
201 | + } |
|
202 | + } else |
|
201 | 203 | { |
202 | - if (!is_null($this->view) && !file_exists($this->view)) |
|
203 | - throw new Exception\ViewNotFoundException("The 'view' template " . $this->view . " does not exists"); |
|
204 | + if (!is_null($this->view) && !file_exists($this->view)) { |
|
205 | + throw new Exception\ViewNotFoundException("The 'view' template " . $this->view . " does not exists"); |
|
206 | + } |
|
204 | 207 | |
205 | 208 | $config = $controller->getModule()->getConfig(); |
206 | 209 | |
207 | - if (!array_key_exists($controller->getLayout(), $config["view_manager"]["template_map"])) |
|
208 | - throw new Exception\PageNotFoundException("The 'template' " . $template . " was not defined in module.config.php"); |
|
210 | + if (!array_key_exists($controller->getLayout(), $config["view_manager"]["template_map"])) { |
|
211 | + throw new Exception\PageNotFoundException("The 'template' " . $template . " was not defined in module.config.php"); |
|
212 | + } |
|
209 | 213 | |
210 | 214 | $template = $config["view_manager"]["template_map"][$controller->getLayout()]; |
211 | 215 | |
212 | - if (!file_exists($template)) |
|
213 | - throw new Exception\PageNotFoundException("The 'template' " . $template . " does not exists"); |
|
216 | + if (!file_exists($template)) { |
|
217 | + throw new Exception\PageNotFoundException("The 'template' " . $template . " does not exists"); |
|
218 | + } |
|
214 | 219 | |
215 | 220 | include $template; |
216 | 221 | } |
@@ -237,8 +242,9 @@ discard block |
||
237 | 242 | */ |
238 | 243 | public function content() |
239 | 244 | { |
240 | - if (!file_exists($this->view)) |
|
241 | - throw new Exception\ViewNotFoundException("The 'view' template " . $this->view . " does not exists"); |
|
245 | + if (!file_exists($this->view)) { |
|
246 | + throw new Exception\ViewNotFoundException("The 'view' template " . $this->view . " does not exists"); |
|
247 | + } |
|
242 | 248 | |
243 | 249 | include $this->view; |
244 | 250 | } |
@@ -109,11 +109,12 @@ |
||
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 |
@@ -298,8 +298,8 @@ |
||
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 |
@@ -209,8 +209,9 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getArrayResult() |
211 | 211 | { |
212 | - if ($this->arrayResult) |
|
213 | - return $this->arrayResult; |
|
212 | + if ($this->arrayResult) { |
|
213 | + return $this->arrayResult; |
|
214 | + } |
|
214 | 215 | |
215 | 216 | return $this->toArray(); |
216 | 217 | } |
@@ -298,8 +299,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -108,7 +108,7 @@ discard block |
||
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 |
||
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 | } |
@@ -24,15 +24,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -52,10 +52,10 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -24,15 +24,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -85,13 +85,14 @@ discard block |
||
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 |
||
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 |
@@ -77,8 +77,9 @@ |
||
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)); |
@@ -22,14 +22,14 @@ discard block |
||
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 |
||
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 |
@@ -73,7 +73,8 @@ |
||
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 |