| @@ -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 | |
| @@ -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'), '`'); | 
| @@ -29,7 +29,7 @@ discard block | ||
| 29 | 29 | */ | 
| 30 | 30 | public function getLastErrorNo() | 
| 31 | 31 |      { | 
| 32 | - return (string)$this->getDriver()->getLastErrorNo(); | |
| 32 | + return (string) $this->getDriver()->getLastErrorNo(); | |
| 33 | 33 | } | 
| 34 | 34 | |
| 35 | 35 | /** | 
| @@ -261,7 +261,7 @@ discard block | ||
| 261 | 261 | public function getTableMetaData($table) | 
| 262 | 262 |      { | 
| 263 | 263 | $metadata = []; | 
| 264 | -        if (! empty($table)) { | |
| 264 | +        if (!empty($table)) { | |
| 265 | 265 | $sql = 'SHOW FIELDS FROM ' . $table; | 
| 266 | 266 | $result = $this->query($sql); | 
| 267 | 267 | $metadata = $this->getDriver()->getTableMetaData($result); | 
| @@ -283,7 +283,7 @@ discard block | ||
| 283 | 283 | */ | 
| 284 | 284 | public function setDriver($driver) | 
| 285 | 285 |      { | 
| 286 | -        if (! \in_array(Interfaces\DriverInterface::class, class_implements($driver), true)) { | |
| 286 | +        if (!\in_array(Interfaces\DriverInterface::class, class_implements($driver), true)) { | |
| 287 | 287 | throw new Exceptions\DriverException( | 
| 288 | 288 | $driver . ' should implements the ' . Interfaces\DriverInterface::class | 
| 289 | 289 | ); | 
| @@ -377,13 +377,12 @@ discard block | ||
| 377 | 377 | |
| 378 | 378 |          if (\is_array($fields)) { | 
| 379 | 379 | $useFields = empty($fromTable) ? | 
| 380 | - $this->prepareValues($fields) : | |
| 381 | - $this->prepareFields($fields, true); | |
| 380 | + $this->prepareValues($fields) : $this->prepareFields($fields, true); | |
| 382 | 381 |          } else { | 
| 383 | 382 | $useFields = $fields; | 
| 384 | 383 | } | 
| 385 | 384 | |
| 386 | -        if (empty($useFields) || ! \is_scalar($useFields) || ($useFields === '*' && ! empty($fromTable))) { | |
| 385 | +        if (empty($useFields) || !\is_scalar($useFields) || ($useFields === '*' && !empty($fromTable))) { | |
| 387 | 386 |              throw (new Exceptions\InvalidFieldException('Invalid insert fields')) | 
| 388 | 387 | ->setData($fields); | 
| 389 | 388 | } | 
| @@ -28,7 +28,7 @@ discard block | ||
| 28 | 28 | */ | 
| 29 | 29 | public function getConnect() | 
| 30 | 30 |      { | 
| 31 | -        if (! $this->isConnected()) { | |
| 31 | +        if (!$this->isConnected()) { | |
| 32 | 32 | return $this->connect(); | 
| 33 | 33 | } | 
| 34 | 34 | |
| @@ -56,7 +56,7 @@ discard block | ||
| 56 | 56 | */ | 
| 57 | 57 | public function getLastErrorNo() | 
| 58 | 58 |      { | 
| 59 | - $out = (string)$this->getConnect()->sqlstate; | |
| 59 | + $out = (string) $this->getConnect()->sqlstate; | |
| 60 | 60 | |
| 61 | 61 |          if ($out === '00000') { | 
| 62 | 62 | $out = ''; | 
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 | throw new Exceptions\ConnectException($this->conn->connect_error); | 
| 84 | 84 | } | 
| 85 | 85 | |
| 86 | -            if (! $this->isConnected()) { | |
| 86 | +            if (!$this->isConnected()) { | |
| 87 | 87 | $this->conn = null; | 
| 88 | 88 | throw new Exceptions\ConnectException( | 
| 89 | 89 | $this->getLastError() ?: 'Failed to create the database connection!' | 
| @@ -94,9 +94,9 @@ discard block | ||
| 94 | 94 | */ | 
| 95 | 95 | public function getConnect() | 
| 96 | 96 |      { | 
| 97 | -        if (! $this->isConnected()) { | |
| 97 | +        if (!$this->isConnected()) { | |
| 98 | 98 | $this->connect(); | 
| 99 | -            if (! $this->conn->getPdo() instanceof PDO) { | |
| 99 | +            if (!$this->conn->getPdo() instanceof PDO) { | |
| 100 | 100 | $this->conn->reconnect(); | 
| 101 | 101 | } | 
| 102 | 102 | } | 
| @@ -138,7 +138,7 @@ discard block | ||
| 138 | 138 | public function connect() | 
| 139 | 139 |      { | 
| 140 | 140 |          try { | 
| 141 | -            if (! $this->hasConnectionName($this->connection)) { | |
| 141 | +            if (!$this->hasConnectionName($this->connection)) { | |
| 142 | 142 | $this->getCapsule()->addConnection([ | 
| 143 | 143 | 'driver' => $this->driver, | 
| 144 | 144 |                      'host'      => $this->getConfig('host'), | 
| @@ -214,7 +214,7 @@ discard block | ||
| 214 | 214 | |
| 215 | 215 | $query = $method . ' ' . $charset; | 
| 216 | 216 | |
| 217 | - return (bool)$this->query($query); | |
| 217 | + return (bool) $this->query($query); | |
| 218 | 218 | } | 
| 219 | 219 | |
| 220 | 220 | /** | 
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | */ | 
| 14 | 14 | public function __construct($message = '', $code = 0, Throwable $previous = null) | 
| 15 | 15 |      { | 
| 16 | - parent::__construct($message, (int)$code, $previous); | |
| 16 | + parent::__construct($message, (int) $code, $previous); | |
| 17 | 17 | |
| 18 | 18 | $this->code = $code; | 
| 19 | 19 | } | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 | */ | 
| 137 | 137 | public function setLastQuery($query) | 
| 138 | 138 |      { | 
| 139 | - $this->lastQuery = (string)$query; | |
| 139 | + $this->lastQuery = (string) $query; | |
| 140 | 140 | |
| 141 | 141 | return $query; | 
| 142 | 142 | } | 
| @@ -146,7 +146,7 @@ discard block | ||
| 146 | 146 | */ | 
| 147 | 147 | public function getLastQuery() | 
| 148 | 148 |      { | 
| 149 | - return (string)$this->lastQuery; | |
| 149 | + return (string) $this->lastQuery; | |
| 150 | 150 | } | 
| 151 | 151 | |
| 152 | 152 | /** | 
| @@ -272,14 +272,14 @@ discard block | ||
| 272 | 272 | $out .= '<fieldset style="text-align:left">'; | 
| 273 | 273 | $out .= '<legend>Query ' . $i . ' - ' . sprintf($this->timeFormat, $query['time']) . '</legend>'; | 
| 274 | 274 | $out .= $query['sql'] . '<br><br>'; | 
| 275 | -            if (! empty($query['element'])) { | |
| 275 | +            if (!empty($query['element'])) { | |
| 276 | 276 | $out .= $query['element']['type'] . ' => ' . $query['element']['name'] . '<br>'; | 
| 277 | 277 | } | 
| 278 | -            if (! empty($query['event'])) { | |
| 278 | +            if (!empty($query['event'])) { | |
| 279 | 279 | $out .= 'Current Event => ' . $query['event'] . '<br>'; | 
| 280 | 280 | } | 
| 281 | 281 | $out .= 'Affected Rows => ' . $query['rows'] . '<br>'; | 
| 282 | -            if (! empty($query['path'])) { | |
| 282 | +            if (!empty($query['path'])) { | |
| 283 | 283 | $out .= 'Functions Path => ' . $query['path'] . '<br>'; | 
| 284 | 284 | } | 
| 285 | 285 | /*$out .= 'Functions Path => ' . $query['path']['method'] . '<br>'; |