@@ -200,14 +200,14 @@ |
||
| 200 | 200 | $out .= '<fieldset style="text-align:left">'; |
| 201 | 201 | $out .= '<legend>Query ' . $i . ' - ' . sprintf($this->timeFormat, $query['time']) . '</legend>'; |
| 202 | 202 | $out .= $query['sql'] . '<br><br>'; |
| 203 | - if (! empty($query['element'])) { |
|
| 203 | + if (!empty($query['element'])) { |
|
| 204 | 204 | $out .= $query['element']['type'] . ' => ' . $query['element']['name'] . '<br>'; |
| 205 | 205 | } |
| 206 | - if (! empty($query['event'])) { |
|
| 206 | + if (!empty($query['event'])) { |
|
| 207 | 207 | $out .= 'Current Event => ' . $query['event'] . '<br>'; |
| 208 | 208 | } |
| 209 | 209 | $out .= 'Affected Rows => ' . $query['rows'] . '<br>'; |
| 210 | - if (! empty($query['path'])) { |
|
| 210 | + if (!empty($query['path'])) { |
|
| 211 | 211 | $out .= 'Functions Path => ' . $query['path'] . '<br>'; |
| 212 | 212 | } |
| 213 | 213 | /*$out .= 'Functions Path => ' . $query['path']['method'] . '<br>'; |
@@ -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 | /** |
@@ -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(int $timestamp, string $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 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if (! \is_scalar($values)) { |
|
| 186 | + if (!\is_scalar($values)) { |
|
| 187 | 187 | throw (new Exceptions\InvalidFieldException('values')) |
| 188 | 188 | ->setData($values); |
| 189 | 189 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | { |
| 228 | 228 | $onlyNumbers = true; |
| 229 | 229 | foreach ($data as $value) { |
| 230 | - if (! \is_numeric($value)) { |
|
| 230 | + if (!\is_numeric($value)) { |
|
| 231 | 231 | $onlyNumbers = false; |
| 232 | 232 | break; |
| 233 | 233 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | $data = implode(' ', $tmp); |
| 274 | 274 | } |
| 275 | - if (! is_scalar($data) || empty($data)) { |
|
| 275 | + if (!is_scalar($data) || empty($data)) { |
|
| 276 | 276 | throw new Exceptions\TableNotDefinedException($data); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | $data = trim($data); |
| 298 | - if (! empty($data) && stripos($data, 'WHERE') !== 0) { |
|
| 298 | + if (!empty($data) && stripos($data, 'WHERE') !== 0) { |
|
| 299 | 299 | $data = "WHERE {$data}"; |
| 300 | 300 | } |
| 301 | 301 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | protected function prepareOrder($data): string |
| 310 | 310 | { |
| 311 | 311 | $data = trim($data); |
| 312 | - if (! empty($data) && stripos($data, 'ORDER') !== 0) { |
|
| 312 | + if (!empty($data) && stripos($data, 'ORDER') !== 0) { |
|
| 313 | 313 | $data = "ORDER BY {$data}"; |
| 314 | 314 | } |
| 315 | 315 | |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | protected function prepareLimit($data): string |
| 324 | 324 | { |
| 325 | 325 | $data = trim($data); |
| 326 | - if (! empty($data) && stripos($data, 'LIMIT') !== 0) { |
|
| 326 | + if (!empty($data) && stripos($data, 'LIMIT') !== 0) { |
|
| 327 | 327 | $data = "LIMIT {$data}"; |
| 328 | 328 | } |
| 329 | 329 | |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | * @param int $col |
| 78 | 78 | * @return null|string |
| 79 | 79 | */ |
| 80 | - public function fieldName($result, $col = 0) :? string; |
|
| 80 | + public function fieldName($result, $col = 0) : ? string; |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * @param string $name |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function getConnect() |
| 38 | 38 | { |
| 39 | - if (! $this->isConnected()) { |
|
| 39 | + if (!$this->isConnected()) { |
|
| 40 | 40 | return $this->connect(); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | throw new Exceptions\ConnectException($this->conn->connect_error); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if (! $this->isConnected()) { |
|
| 64 | + if (!$this->isConnected()) { |
|
| 65 | 65 | throw new Exceptions\ConnectException( |
| 66 | 66 | $this->getLastError() ?: 'Failed to create the database connection!' |
| 67 | 67 | ); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param int $col |
| 177 | 177 | * @return string|null |
| 178 | 178 | */ |
| 179 | - public function fieldName($result, $col = 0) :? string |
|
| 179 | + public function fieldName($result, $col = 0) : ? string |
|
| 180 | 180 | { |
| 181 | 181 | $field = $result->fetch_field_direct($col); |
| 182 | 182 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'method' |
| 54 | 54 | )); |
| 55 | 55 | |
| 56 | - if (! \in_array(Interfaces\DriverInterface::class, class_implements($driver), true)) { |
|
| 56 | + if (!\in_array(Interfaces\DriverInterface::class, class_implements($driver), true)) { |
|
| 57 | 57 | throw new Exceptions\DriverException( |
| 58 | 58 | $driver . ' should implements the ' . Interfaces\DriverInterface::class |
| 59 | 59 | ); |
@@ -271,13 +271,12 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | if (\is_array($fields)) { |
| 273 | 273 | $useFields = empty($fromTable) ? |
| 274 | - $this->prepareValues($fields) : |
|
| 275 | - $this->prepareFields($fields, true); |
|
| 274 | + $this->prepareValues($fields) : $this->prepareFields($fields, true); |
|
| 276 | 275 | } else { |
| 277 | 276 | $useFields = $fields; |
| 278 | 277 | } |
| 279 | 278 | |
| 280 | - if (empty($useFields) || ! \is_scalar($useFields) || ($useFields === '*' && ! empty($fromTable))) { |
|
| 279 | + if (empty($useFields) || !\is_scalar($useFields) || ($useFields === '*' && !empty($fromTable))) { |
|
| 281 | 280 | throw (new Exceptions\InvalidFieldException('Invalid insert fields')) |
| 282 | 281 | ->setData($fields); |
| 283 | 282 | } |
@@ -353,7 +352,7 @@ discard block |
||
| 353 | 352 | * @param int $col |
| 354 | 353 | * @return string|null |
| 355 | 354 | */ |
| 356 | - public function fieldName($result, $col = 0) :? string |
|
| 355 | + public function fieldName($result, $col = 0) : ? string |
|
| 357 | 356 | { |
| 358 | 357 | return $this->getDriver()->fieldName($result, $col); |
| 359 | 358 | } |
@@ -468,7 +467,7 @@ discard block |
||
| 468 | 467 | public function getTableMetaData(string $table) : array |
| 469 | 468 | { |
| 470 | 469 | $metadata = []; |
| 471 | - if (! empty($table)) { |
|
| 470 | + if (!empty($table)) { |
|
| 472 | 471 | $sql = 'SHOW FIELDS FROM ' . $table; |
| 473 | 472 | $result = $this->query($sql); |
| 474 | 473 | $metadata = $this->getDriver()->getTableMetaData($result); |