@@ -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 | |
@@ -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 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function setDriver($driver) |
| 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 | ); |
@@ -319,13 +319,12 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | if (\is_array($fields)) { |
| 321 | 321 | $useFields = empty($fromTable) ? |
| 322 | - $this->prepareValues($fields) : |
|
| 323 | - $this->prepareFields($fields, true); |
|
| 322 | + $this->prepareValues($fields) : $this->prepareFields($fields, true); |
|
| 324 | 323 | } else { |
| 325 | 324 | $useFields = $fields; |
| 326 | 325 | } |
| 327 | 326 | |
| 328 | - if (empty($useFields) || ! \is_scalar($useFields) || ($useFields === '*' && ! empty($fromTable))) { |
|
| 327 | + if (empty($useFields) || !\is_scalar($useFields) || ($useFields === '*' && !empty($fromTable))) { |
|
| 329 | 328 | throw (new Exceptions\InvalidFieldException('Invalid insert fields')) |
| 330 | 329 | ->setData($fields); |
| 331 | 330 | } |
@@ -494,7 +493,7 @@ discard block |
||
| 494 | 493 | public function getTableMetaData($table) |
| 495 | 494 | { |
| 496 | 495 | $metadata = []; |
| 497 | - if (! empty($table)) { |
|
| 496 | + if (!empty($table)) { |
|
| 498 | 497 | $sql = 'SHOW FIELDS FROM ' . $table; |
| 499 | 498 | $result = $this->query($sql); |
| 500 | 499 | $metadata = $this->getDriver()->getTableMetaData($result); |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | public function replaceFullTableName($tableName, $force = false) |
| 54 | 54 | { |
| 55 | 55 | $tableName = trim($tableName); |
| 56 | - if ((bool)$force === true) { |
|
| 56 | + if ((bool) $force === true) { |
|
| 57 | 57 | $result = $this->getFullTableName($tableName); |
| 58 | 58 | } elseif (strpos($tableName, '[+prefix+]') !== false) { |
| 59 | 59 | $dbase = trim($this->getConfig('database'), '`'); |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function getConnect() |
| 125 | 125 | { |
| 126 | - if (! $this->isConnected()) { |
|
| 126 | + if (!$this->isConnected()) { |
|
| 127 | 127 | $this->connect(); |
| 128 | - if (! $this->conn->getPdo() instanceof PDO) { |
|
| 128 | + if (!$this->conn->getPdo() instanceof PDO) { |
|
| 129 | 129 | $this->conn->reconnect(); |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | public function connect() |
| 151 | 151 | { |
| 152 | 152 | try { |
| 153 | - if (! $this->hasConnectionName($this->connection)) { |
|
| 153 | + if (!$this->hasConnectionName($this->connection)) { |
|
| 154 | 154 | $this->getCapsule()->addConnection([ |
| 155 | 155 | 'driver' => $this->driver, |
| 156 | 156 | 'host' => $this->config['host'], |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | $query = $method . ' ' . $charset . ' COLLATE ' . $collation; |
| 258 | 258 | |
| 259 | - return (bool)$this->query($query); |
|
| 259 | + return (bool) $this->query($query); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | { |
| 373 | 373 | $pdo = $this->getConnect()->getPdo(); |
| 374 | 374 | $error = $pdo->errorInfo(); |
| 375 | - return (string)(isset($error[2]) ? $error[2] : $this->lastError[2]); |
|
| 375 | + return (string) (isset($error[2]) ? $error[2] : $this->lastError[2]); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | /** |
@@ -383,6 +383,6 @@ discard block |
||
| 383 | 383 | { |
| 384 | 384 | $pdo = $this->getConnect()->getPdo(); |
| 385 | 385 | $error = $pdo->errorInfo(); |
| 386 | - return (string)(isset($error[1]) ? $error[1] : $this->lastErrorNo); |
|
| 386 | + return (string) (isset($error[1]) ? $error[1] : $this->lastErrorNo); |
|
| 387 | 387 | } |
| 388 | 388 | } |