@@ -22,9 +22,9 @@ |
||
22 | 22 | protected $timeFormat = '%2.5f'; |
23 | 23 | |
24 | 24 | /** |
25 | - * @return mixed |
|
25 | + * @return mixed |
|
26 | 26 | * @throws Exceptions\Exception |
27 | - */ |
|
27 | + */ |
|
28 | 28 | abstract public function getDriver(); |
29 | 29 | |
30 | 30 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getLastErrorNo() |
56 | 56 | { |
57 | - return (string)$this->getDriver()->getLastErrorNo(); |
|
57 | + return (string) $this->getDriver()->getLastErrorNo(); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | $out .= '<fieldset style="text-align:left">'; |
193 | 193 | $out .= '<legend>Query ' . $i . ' - ' . sprintf($this->timeFormat, $query['time']) . '</legend>'; |
194 | 194 | $out .= $query['sql'] . '<br><br>'; |
195 | - if (! empty($query['element'])) { |
|
195 | + if (!empty($query['element'])) { |
|
196 | 196 | $out .= $query['element']['type'] . ' => ' . $query['element']['name'] . '<br>'; |
197 | 197 | } |
198 | - if (! empty($query['event'])) { |
|
198 | + if (!empty($query['event'])) { |
|
199 | 199 | $out .= 'Current Event => ' . $query['event'] . '<br>'; |
200 | 200 | } |
201 | 201 | $out .= 'Affected Rows => ' . $query['rows'] . '<br>'; |
202 | - if (! empty($query['path'])) { |
|
202 | + if (!empty($query['path'])) { |
|
203 | 203 | $out .= 'Functions Path => ' . $query['path'] . '<br>'; |
204 | 204 | } |
205 | 205 | /*$out .= 'Functions Path => ' . $query['path']['method'] . '<br>'; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function __construct($message = "", $code = 0, Throwable $previous = null) |
14 | 14 | { |
15 | - parent::__construct($message, (int)$code, $previous); |
|
15 | + parent::__construct($message, (int) $code, $previous); |
|
16 | 16 | |
17 | 17 | $this->code = $code; |
18 | 18 | } |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | protected function convertValue($value) |
52 | 52 | { |
53 | 53 | switch (true) { |
54 | - case (\is_numeric($value) && ! \is_float(1 * $value)): |
|
55 | - $value = (int)$value; |
|
54 | + case (\is_numeric($value) && !\is_float(1 * $value)): |
|
55 | + $value = (int) $value; |
|
56 | 56 | break; |
57 | - case \is_numeric($value) && \is_float(1*$value): |
|
58 | - $value = (float)$value; |
|
57 | + case \is_numeric($value) && \is_float(1 * $value): |
|
58 | + $value = (float) $value; |
|
59 | 59 | break; |
60 | 60 | default: |
61 | 61 | break; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function convertDate($timestamp, $fieldType = 'DATETIME') |
74 | 74 | { |
75 | 75 | $date = false; |
76 | - if (! empty($timestamp) && $timestamp > 0) { |
|
76 | + if (!empty($timestamp) && $timestamp > 0) { |
|
77 | 77 | switch ($fieldType) { |
78 | 78 | case 'DATE': |
79 | 79 | $date = date('Y-m-d', $timestamp); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if (\is_array($data)) { |
105 | 105 | $tmp = []; |
106 | 106 | foreach ($data as $alias => $field) { |
107 | - $tmp[] = ($alias !== $field && ! \is_int($alias) && $ignoreAlias === false) ? |
|
107 | + $tmp[] = ($alias !== $field && !\is_int($alias) && $ignoreAlias === false) ? |
|
108 | 108 | ($field . ' as `' . $alias . '`') : $field; |
109 | 109 | } |
110 | 110 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - if (! \is_scalar($values)) { |
|
185 | + if (!\is_scalar($values)) { |
|
186 | 186 | throw (new Exceptions\InvalidFieldException('values')) |
187 | 187 | ->setData($values); |
188 | 188 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | $onlyNumbers = true; |
228 | 228 | foreach ($data as $value) { |
229 | - if (! \is_numeric($value)) { |
|
229 | + if (!\is_numeric($value)) { |
|
230 | 230 | $onlyNumbers = false; |
231 | 231 | break; |
232 | 232 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | } |
272 | 272 | $data = implode(' ', $tmp); |
273 | 273 | } |
274 | - if (! is_scalar($data) || empty($data)) { |
|
274 | + if (!is_scalar($data) || empty($data)) { |
|
275 | 275 | throw new Exceptions\TableNotDefinedException($data); |
276 | 276 | } |
277 | 277 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | } |
296 | 296 | $data = trim($data); |
297 | - if (! empty($data) && stripos($data, 'WHERE') !== 0) { |
|
297 | + if (!empty($data) && stripos($data, 'WHERE') !== 0) { |
|
298 | 298 | $data = "WHERE {$data}"; |
299 | 299 | } |
300 | 300 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | protected function prepareOrder($data) |
309 | 309 | { |
310 | 310 | $data = trim($data); |
311 | - if (! empty($data) && stripos($data, 'ORDER') !== 0) { |
|
311 | + if (!empty($data) && stripos($data, 'ORDER') !== 0) { |
|
312 | 312 | $data = "ORDER BY {$data}"; |
313 | 313 | } |
314 | 314 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | protected function prepareLimit($data) |
323 | 323 | { |
324 | 324 | $data = trim($data); |
325 | - if (! empty($data) && stripos($data, 'LIMIT') !== 0) { |
|
325 | + if (!empty($data) && stripos($data, 'LIMIT') !== 0) { |
|
326 | 326 | $data = "LIMIT {$data}"; |
327 | 327 | } |
328 | 328 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getConnect() |
59 | 59 | { |
60 | - if (! $this->isConnected()) { |
|
60 | + if (!$this->isConnected()) { |
|
61 | 61 | return $this->connect(); |
62 | 62 | } |
63 | 63 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $method = $this->config['method']; |
175 | 175 | } |
176 | 176 | |
177 | - return (bool)$this->query($method . ' ' . $charset . ' COLLATE ' . $collation); |
|
177 | + return (bool) $this->query($method . ' ' . $charset . ' COLLATE ' . $collation); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | { |
364 | 364 | $pdo = $this->getConnect()->getPdo(); |
365 | 365 | $error = $pdo->errorInfo(); |
366 | - return (string)(isset($error[2]) ? $error[2] : $this->lastError[2]); |
|
366 | + return (string) (isset($error[2]) ? $error[2] : $this->lastError[2]); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | { |
375 | 375 | $pdo = $this->getConnect()->getPdo(); |
376 | 376 | $error = $pdo->errorInfo(); |
377 | - return (string)(isset($error[1]) ? $error[1] : $this->lastErrorNo); |
|
377 | + return (string) (isset($error[1]) ? $error[1] : $this->lastErrorNo); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'collation' |
57 | 57 | )); |
58 | 58 | |
59 | - if (! \in_array(Interfaces\DriverInterface::class, class_implements($driver), true)) { |
|
59 | + if (!\in_array(Interfaces\DriverInterface::class, class_implements($driver), true)) { |
|
60 | 60 | throw new Exceptions\DriverException( |
61 | 61 | $driver . ' should implements the ' . Interfaces\DriverInterface::class |
62 | 62 | ); |
@@ -282,13 +282,12 @@ discard block |
||
282 | 282 | |
283 | 283 | if (\is_array($fields)) { |
284 | 284 | $useFields = empty($fromTable) ? |
285 | - $this->prepareValues($fields) : |
|
286 | - $this->prepareFields($fields, true); |
|
285 | + $this->prepareValues($fields) : $this->prepareFields($fields, true); |
|
287 | 286 | } else { |
288 | 287 | $useFields = $fields; |
289 | 288 | } |
290 | 289 | |
291 | - if (empty($useFields) || ! \is_scalar($useFields) || ($useFields === '*' && ! empty($fromTable))) { |
|
290 | + if (empty($useFields) || !\is_scalar($useFields) || ($useFields === '*' && !empty($fromTable))) { |
|
292 | 291 | throw (new Exceptions\InvalidFieldException('Invalid insert fields')) |
293 | 292 | ->setData($fields); |
294 | 293 | } |
@@ -480,7 +479,7 @@ discard block |
||
480 | 479 | public function getTableMetaData($table) |
481 | 480 | { |
482 | 481 | $metadata = []; |
483 | - if (! empty($table)) { |
|
482 | + if (!empty($table)) { |
|
484 | 483 | $sql = 'SHOW FIELDS FROM ' . $table; |
485 | 484 | $result = $this->query($sql); |
486 | 485 | $metadata = $this->getDriver()->getTableMetaData($result); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getConnect() |
39 | 39 | { |
40 | - if (! $this->isConnected()) { |
|
40 | + if (!$this->isConnected()) { |
|
41 | 41 | return $this->connect(); |
42 | 42 | } |
43 | 43 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | throw new Exceptions\ConnectException($this->conn->connect_error); |
63 | 63 | } |
64 | 64 | |
65 | - if (! $this->isConnected()) { |
|
65 | + if (!$this->isConnected()) { |
|
66 | 66 | throw new Exceptions\ConnectException( |
67 | 67 | $this->getLastError() ?: 'Failed to create the database connection!' |
68 | 68 | ); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function getLastErrorNo() |
336 | 336 | { |
337 | - return (string)$this->getConnect()->sqlstate; |
|
337 | + return (string) $this->getConnect()->sqlstate; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |