@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $start = microtime(true); |
| 233 | 233 | $sqlStatement = empty($bindings) ? $sql : $this->interpolateQuery($sql, $bindings); |
| 234 | 234 | |
| 235 | - if (!is_string($sqlStatement)) { |
|
| 235 | + if ( ! is_string($sqlStatement)) { |
|
| 236 | 236 | throw new Exception('Could not interpolate query', 1); |
| 237 | 237 | } |
| 238 | 238 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | public function get() |
| 250 | 250 | { |
| 251 | 251 | $eventResult = $this->fireEvents('before-select'); |
| 252 | - if (!is_null($eventResult)) { |
|
| 252 | + if ( ! is_null($eventResult)) { |
|
| 253 | 253 | return $eventResult; |
| 254 | 254 | } |
| 255 | 255 | $executionTime = 0; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $this->sqlStatement = null; |
| 275 | 275 | |
| 276 | 276 | // Ensure we have an array of results. |
| 277 | - if (!is_array($result) && null !== $result) { |
|
| 277 | + if ( ! is_array($result) && null !== $result) { |
|
| 278 | 278 | $result = [$result]; |
| 279 | 279 | } |
| 280 | 280 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | protected function useHydrator(): bool |
| 309 | 309 | { |
| 310 | - return !in_array($this->getFetchMode(), [\ARRAY_A, \ARRAY_N, \OBJECT, \OBJECT_K]); |
|
| 310 | + return ! in_array($this->getFetchMode(), [\ARRAY_A, \ARRAY_N, \OBJECT, \OBJECT_K]); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | /** |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | ->select([$this->raw(sprintf('%s(%s) AS field', strtoupper($type), $field))]) |
| 409 | 409 | ->first(); |
| 410 | 410 | |
| 411 | - return true === isset($count->field) ? (float)$count->field : 0; |
|
| 411 | + return true === isset($count->field) ? (float) $count->field : 0; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | public function count($field = '*'): int |
| 426 | 426 | { |
| 427 | - return (int)$this->aggregate('count', $field); |
|
| 427 | + return (int) $this->aggregate('count', $field); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /** |
@@ -502,8 +502,8 @@ discard block |
||
| 502 | 502 | public function getQuery(string $type = 'select', $dataToBePassed = []) |
| 503 | 503 | { |
| 504 | 504 | $allowedTypes = ['select', 'insert', 'insertignore', 'replace', 'delete', 'update', 'criteriaonly']; |
| 505 | - if (!in_array(strtolower($type), $allowedTypes)) { |
|
| 506 | - throw new Exception($type . ' is not a known type.', 2); |
|
| 505 | + if ( ! in_array(strtolower($type), $allowedTypes)) { |
|
| 506 | + throw new Exception($type.' is not a known type.', 2); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | $queryArr = $this->adapterInstance->$type($this->statements, $dataToBePassed); |
@@ -522,9 +522,9 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | public function subQuery(QueryBuilderHandler $queryBuilder, ?string $alias = null) |
| 524 | 524 | { |
| 525 | - $sql = '(' . $queryBuilder->getQuery()->getRawSql() . ')'; |
|
| 525 | + $sql = '('.$queryBuilder->getQuery()->getRawSql().')'; |
|
| 526 | 526 | if (is_string($alias) && 0 !== mb_strlen($alias)) { |
| 527 | - $sql = $sql . ' as ' . $alias; |
|
| 527 | + $sql = $sql.' as '.$alias; |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | return $queryBuilder->raw($sql); |
@@ -541,12 +541,12 @@ discard block |
||
| 541 | 541 | private function doInsert(array $data, string $type) |
| 542 | 542 | { |
| 543 | 543 | $eventResult = $this->fireEvents('before-insert'); |
| 544 | - if (!is_null($eventResult)) { |
|
| 544 | + if ( ! is_null($eventResult)) { |
|
| 545 | 545 | return $eventResult; |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | // If first value is not an array () not a batch insert) |
| 549 | - if (!is_array(current($data))) { |
|
| 549 | + if ( ! is_array(current($data))) { |
|
| 550 | 550 | $queryObject = $this->getQuery($type, $data); |
| 551 | 551 | |
| 552 | 552 | list($preparedQuery, $executionTime) = $this->statement($queryObject->getSql(), $queryObject->getBindings()); |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | public function update(array $data): ?int |
| 617 | 617 | { |
| 618 | 618 | $eventResult = $this->fireEvents('before-update'); |
| 619 | - if (!is_null($eventResult)) { |
|
| 619 | + if ( ! is_null($eventResult)) { |
|
| 620 | 620 | return $eventResult; |
| 621 | 621 | } |
| 622 | 622 | $queryObject = $this->getQuery('update', $data); |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | public function delete() |
| 670 | 670 | { |
| 671 | 671 | $eventResult = $this->fireEvents('before-delete'); |
| 672 | - if (!is_null($eventResult)) { |
|
| 672 | + if ( ! is_null($eventResult)) { |
|
| 673 | 673 | return $eventResult; |
| 674 | 674 | } |
| 675 | 675 | |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | */ |
| 692 | 692 | public function table(...$tables) |
| 693 | 693 | { |
| 694 | - $instance = $this->constructCurrentBuilderClass($this->connection); |
|
| 694 | + $instance = $this->constructCurrentBuilderClass($this->connection); |
|
| 695 | 695 | $this->setFetchMode($this->getFetchMode(), $this->hydratorConstructorArgs); |
| 696 | 696 | $tables = $this->addTablePrefix($tables, false); |
| 697 | 697 | $instance->addStatement('tables', $tables); |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | */ |
| 720 | 720 | public function select($fields): self |
| 721 | 721 | { |
| 722 | - if (!is_array($fields)) { |
|
| 722 | + if ( ! is_array($fields)) { |
|
| 723 | 723 | $fields = func_get_args(); |
| 724 | 724 | } |
| 725 | 725 | |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | */ |
| 781 | 781 | public function orderBy($fields, string $defaultDirection = 'ASC'): self |
| 782 | 782 | { |
| 783 | - if (!is_array($fields)) { |
|
| 783 | + if ( ! is_array($fields)) { |
|
| 784 | 784 | $fields = [$fields]; |
| 785 | 785 | } |
| 786 | 786 | |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | $field = $this->jsonHandler->extractAndUnquoteFromJsonSelector($field); |
| 797 | 797 | } |
| 798 | 798 | |
| 799 | - if (!$field instanceof Raw) { |
|
| 799 | + if ( ! $field instanceof Raw) { |
|
| 800 | 800 | $field = $this->addTablePrefix($field); |
| 801 | 801 | } |
| 802 | 802 | $this->statements['orderBys'][] = compact('field', 'type'); |
@@ -1148,7 +1148,7 @@ discard block |
||
| 1148 | 1148 | throw new Exception('Key used for whereNull condition must be a string or raw exrpession.', 1); |
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | - return $this->{$operator . 'Where'}($this->raw("{$key} IS{$prefix} NULL")); |
|
| 1151 | + return $this->{$operator.'Where'}($this->raw("{$key} IS{$prefix} NULL")); |
|
| 1152 | 1152 | } |
| 1153 | 1153 | |
| 1154 | 1154 | |
@@ -1245,8 +1245,8 @@ discard block |
||
| 1245 | 1245 | $value = $this->jsonHandler->extractAndUnquoteFromJsonSelector($value); |
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | - if (!$key instanceof Closure) { |
|
| 1249 | - $key = function ($joinBuilder) use ($key, $operator, $value) { |
|
| 1248 | + if ( ! $key instanceof Closure) { |
|
| 1249 | + $key = function($joinBuilder) use ($key, $operator, $value) { |
|
| 1250 | 1250 | $joinBuilder->on($key, $operator, $value); |
| 1251 | 1251 | }; |
| 1252 | 1252 | } |
@@ -1339,7 +1339,7 @@ discard block |
||
| 1339 | 1339 | */ |
| 1340 | 1340 | public function joinUsing(string $table, string $key, string $type = 'INNER'): self |
| 1341 | 1341 | { |
| 1342 | - if (!array_key_exists('tables', $this->statements) || count($this->statements['tables']) !== 1) { |
|
| 1342 | + if ( ! array_key_exists('tables', $this->statements) || count($this->statements['tables']) !== 1) { |
|
| 1343 | 1343 | throw new Exception("JoinUsing can only be used with a single table set as the base of the query", 1); |
| 1344 | 1344 | } |
| 1345 | 1345 | $baseTable = end($this->statements['tables']); |
@@ -1430,11 +1430,11 @@ discard block |
||
| 1430 | 1430 | */ |
| 1431 | 1431 | protected function addStatement($key, $value) |
| 1432 | 1432 | { |
| 1433 | - if (!is_array($value)) { |
|
| 1433 | + if ( ! is_array($value)) { |
|
| 1434 | 1434 | $value = [$value]; |
| 1435 | 1435 | } |
| 1436 | 1436 | |
| 1437 | - if (!array_key_exists($key, $this->statements)) { |
|
| 1437 | + if ( ! array_key_exists($key, $this->statements)) { |
|
| 1438 | 1438 | $this->statements[$key] = $value; |
| 1439 | 1439 | } else { |
| 1440 | 1440 | $this->statements[$key] = array_merge($this->statements[$key], $value); |