@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function select(array $statements): array |
| 51 | 51 | { |
| 52 | - if (!array_key_exists('tables', $statements)) { |
|
| 52 | + if ( ! array_key_exists('tables', $statements)) { |
|
| 53 | 53 | throw new Exception('No table specified.', 3); |
| 54 | - } elseif (!array_key_exists('selects', $statements)) { |
|
| 54 | + } elseif ( ! array_key_exists('selects', $statements)) { |
|
| 55 | 55 | $statements['selects'][] = '*'; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // Group bys |
| 67 | 67 | $groupBys = ''; |
| 68 | 68 | if (isset($statements['groupBys']) && $groupBys = $this->arrayStr($statements['groupBys'], ', ')) { |
| 69 | - $groupBys = 'GROUP BY ' . $groupBys; |
|
| 69 | + $groupBys = 'GROUP BY '.$groupBys; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Order bys |
@@ -77,17 +77,17 @@ discard block |
||
| 77 | 77 | if ($field instanceof Closure) { |
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | - $orderBys .= $field . ' ' . $orderBy['type'] . ', '; |
|
| 80 | + $orderBys .= $field.' '.$orderBy['type'].', '; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if ($orderBys = trim($orderBys, ', ')) { |
| 84 | - $orderBys = 'ORDER BY ' . $orderBys; |
|
| 84 | + $orderBys = 'ORDER BY '.$orderBys; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // Limit and offset |
| 89 | - $limit = isset($statements['limit']) ? 'LIMIT ' . (int) $statements['limit'] : ''; |
|
| 90 | - $offset = isset($statements['offset']) ? 'OFFSET ' . (int) $statements['offset'] : ''; |
|
| 89 | + $limit = isset($statements['limit']) ? 'LIMIT '.(int) $statements['limit'] : ''; |
|
| 90 | + $offset = isset($statements['offset']) ? 'OFFSET '.(int) $statements['offset'] : ''; |
|
| 91 | 91 | |
| 92 | 92 | // Having |
| 93 | 93 | list($havingCriteria, $havingBindings) = $this->buildCriteriaWithType($statements, 'havings', 'HAVING'); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | /** @var string[] */ |
| 99 | 99 | $sqlArray = [ |
| 100 | - 'SELECT' . (isset($statements['distinct']) ? ' DISTINCT' : ''), |
|
| 100 | + 'SELECT'.(isset($statements['distinct']) ? ' DISTINCT' : ''), |
|
| 101 | 101 | $selects, |
| 102 | 102 | 'FROM', |
| 103 | 103 | $tables, |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | public function criteriaOnly(array $statements, bool $bindValues = true): array |
| 132 | 132 | { |
| 133 | 133 | $sql = $bindings = []; |
| 134 | - if (!isset($statements['criteria'])) { |
|
| 134 | + if ( ! isset($statements['criteria'])) { |
|
| 135 | 135 | return compact('sql', 'bindings'); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | private function doInsert(array $statements, array $data, string $type): array |
| 155 | 155 | { |
| 156 | - if (!isset($statements['tables'])) { |
|
| 156 | + if ( ! isset($statements['tables'])) { |
|
| 157 | 157 | throw new Exception('No table specified', 3); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -174,20 +174,20 @@ discard block |
||
| 174 | 174 | if ($value instanceof Raw) { |
| 175 | 175 | $values[] = $this->parseRaw($value); |
| 176 | 176 | } elseif ($isBindings) { |
| 177 | - $values[] = $value->getType(); |
|
| 177 | + $values[] = $value->getType(); |
|
| 178 | 178 | $bindings[] = $value->getValue(); |
| 179 | 179 | } else { |
| 180 | - $values[] = $this->inferType($value); |
|
| 180 | + $values[] = $this->inferType($value); |
|
| 181 | 181 | $bindings[] = $value; |
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | $sqlArray = [ |
| 186 | - $type . ' INTO', |
|
| 186 | + $type.' INTO', |
|
| 187 | 187 | $this->wrapSanitizer($table), |
| 188 | - '(' . $this->arrayStr($keys, ',') . ')', |
|
| 188 | + '('.$this->arrayStr($keys, ',').')', |
|
| 189 | 189 | 'VALUES', |
| 190 | - '(' . $this->arrayStr($values, ',') . ')', |
|
| 190 | + '('.$this->arrayStr($values, ',').')', |
|
| 191 | 191 | ]; |
| 192 | 192 | |
| 193 | 193 | if (isset($statements['onduplicate'])) { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | throw new Exception('No data given.', 4); |
| 196 | 196 | } |
| 197 | 197 | list($updateStatement, $updateBindings) = $this->getUpdateStatement($statements['onduplicate']); |
| 198 | - $sqlArray[] = 'ON DUPLICATE KEY UPDATE ' . $updateStatement; |
|
| 198 | + $sqlArray[] = 'ON DUPLICATE KEY UPDATE '.$updateStatement; |
|
| 199 | 199 | $bindings = array_merge($bindings, $updateBindings); |
| 200 | 200 | } |
| 201 | 201 | |
@@ -303,12 +303,12 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | if ($value instanceof Raw) { |
| 306 | - $statement .= $this->stringifyValue($this->wrapSanitizer($key)) . '=' . $value . ','; |
|
| 306 | + $statement .= $this->stringifyValue($this->wrapSanitizer($key)).'='.$value.','; |
|
| 307 | 307 | } elseif ($isBindings) { |
| 308 | - $statement .= $this->stringifyValue($this->wrapSanitizer($key)) . sprintf('=%s,', $value->getType()); |
|
| 308 | + $statement .= $this->stringifyValue($this->wrapSanitizer($key)).sprintf('=%s,', $value->getType()); |
|
| 309 | 309 | $bindings[] = $value->getValue(); |
| 310 | 310 | } else { |
| 311 | - $statement .= $this->stringifyValue($this->wrapSanitizer($key)) . sprintf('=%s,', $this->inferType($value)); |
|
| 311 | + $statement .= $this->stringifyValue($this->wrapSanitizer($key)).sprintf('=%s,', $this->inferType($value)); |
|
| 312 | 312 | $bindings[] = $value; |
| 313 | 313 | } |
| 314 | 314 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public function update($statements, array $data) |
| 332 | 332 | { |
| 333 | - if (!isset($statements['tables'])) { |
|
| 333 | + if ( ! isset($statements['tables'])) { |
|
| 334 | 334 | throw new Exception('No table specified', 3); |
| 335 | 335 | } elseif (count($data) < 1) { |
| 336 | 336 | throw new Exception('No data given.', 4); |
@@ -345,12 +345,12 @@ discard block |
||
| 345 | 345 | list($whereCriteria, $whereBindings) = $this->buildCriteriaWithType($statements, 'wheres', 'WHERE'); |
| 346 | 346 | |
| 347 | 347 | // Limit |
| 348 | - $limit = isset($statements['limit']) ? 'LIMIT ' . $statements['limit'] : ''; |
|
| 348 | + $limit = isset($statements['limit']) ? 'LIMIT '.$statements['limit'] : ''; |
|
| 349 | 349 | |
| 350 | 350 | $sqlArray = [ |
| 351 | 351 | 'UPDATE', |
| 352 | 352 | $this->wrapSanitizer($table), |
| 353 | - 'SET ' . $updateStatement, |
|
| 353 | + 'SET '.$updateStatement, |
|
| 354 | 354 | $whereCriteria, |
| 355 | 355 | $limit, |
| 356 | 356 | ]; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | public function delete($statements) |
| 375 | 375 | { |
| 376 | - if (!isset($statements['tables'])) { |
|
| 376 | + if ( ! isset($statements['tables'])) { |
|
| 377 | 377 | throw new Exception('No table specified', 3); |
| 378 | 378 | } |
| 379 | 379 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | list($whereCriteria, $whereBindings) = $this->buildCriteriaWithType($statements, 'wheres', 'WHERE'); |
| 389 | 389 | |
| 390 | 390 | // Limit |
| 391 | - $limit = isset($statements['limit']) ? 'LIMIT ' . $statements['limit'] : ''; |
|
| 391 | + $limit = isset($statements['limit']) ? 'LIMIT '.$statements['limit'] : ''; |
|
| 392 | 392 | |
| 393 | 393 | $sqlArray = ['DELETE FROM', $table, $whereCriteria]; |
| 394 | 394 | $sql = $this->concatenateQuery($sqlArray); |
@@ -410,11 +410,11 @@ discard block |
||
| 410 | 410 | { |
| 411 | 411 | $str = ''; |
| 412 | 412 | foreach ($pieces as $key => $piece) { |
| 413 | - if (!is_int($key)) { |
|
| 414 | - $piece = $key . ' AS ' . $piece; |
|
| 413 | + if ( ! is_int($key)) { |
|
| 414 | + $piece = $key.' AS '.$piece; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - $str .= $piece . $glue; |
|
| 417 | + $str .= $piece.$glue; |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | return trim($str, $glue); |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | { |
| 432 | 432 | $str = ''; |
| 433 | 433 | foreach ($pieces as $piece) { |
| 434 | - $str = trim($str) . ' ' . trim($piece); |
|
| 434 | + $str = trim($str).' '.trim($piece); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | return trim($str); |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | public function getType($value): string |
| 447 | 447 | { |
| 448 | 448 | return $value instanceof Binding && $value->getType() !== null |
| 449 | - ? $value->getType() : $this->inferType($value) ; |
|
| 449 | + ? $value->getType() : $this->inferType($value); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | |
| 490 | 490 | |
| 491 | 491 | $bindings = array_map([$this, 'getValue'], $bindings); |
| 492 | - $query = $this->connection->getDbInstance()->prepare($query, $bindings) ; |
|
| 492 | + $query = $this->connection->getDbInstance()->prepare($query, $bindings); |
|
| 493 | 493 | return is_string($query) ? $query : ''; |
| 494 | 494 | } |
| 495 | 495 | |
@@ -530,10 +530,10 @@ discard block |
||
| 530 | 530 | // Merge the bindings we get from nestedCriteria object |
| 531 | 531 | $bindings = array_merge($bindings, $queryObject->getBindings()); |
| 532 | 532 | // Append the sql we get from the nestedCriteria object |
| 533 | - $criteria .= $statement['joiner'] . ' (' . $queryObject->getSql() . ') '; |
|
| 533 | + $criteria .= $statement['joiner'].' ('.$queryObject->getSql().') '; |
|
| 534 | 534 | } elseif (is_array($value)) { |
| 535 | 535 | // where_in or between like query |
| 536 | - $criteria .= $statement['joiner'] . ' ' . $key . ' ' . $statement['operator']; |
|
| 536 | + $criteria .= $statement['joiner'].' '.$key.' '.$statement['operator']; |
|
| 537 | 537 | |
| 538 | 538 | switch ($statement['operator']) { |
| 539 | 539 | case 'BETWEEN': |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | $value[1] = $this->getValue($value[1]); |
| 550 | 550 | |
| 551 | 551 | // Parse any raws. |
| 552 | - $value = array_map(function ($value) { |
|
| 552 | + $value = array_map(function($value) { |
|
| 553 | 553 | return $value instanceof Raw |
| 554 | 554 | ? $this->parseRaw($value) |
| 555 | 555 | : $value; |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | $valuePlaceholder = trim($valuePlaceholder, ', '); |
| 576 | - $criteria .= ' (' . $valuePlaceholder . ') '; |
|
| 576 | + $criteria .= ' ('.$valuePlaceholder.') '; |
|
| 577 | 577 | break; |
| 578 | 578 | } |
| 579 | 579 | } elseif ($value instanceof Raw) { |
@@ -581,20 +581,20 @@ discard block |
||
| 581 | 581 | $criteria .= "{$statement['joiner']} {$key} {$statement['operator']} $value "; |
| 582 | 582 | } else { |
| 583 | 583 | // Usual where like criteria |
| 584 | - if (!$bindValues) { |
|
| 584 | + if ( ! $bindValues) { |
|
| 585 | 585 | // Specially for joins |
| 586 | 586 | // We are not binding values, lets sanitize then |
| 587 | 587 | $value = $this->stringifyValue($this->wrapSanitizer($value)) ?? ''; |
| 588 | - $criteria .= $statement['joiner'] . ' ' . $key . ' ' . $statement['operator'] . ' ' . $value . ' '; |
|
| 588 | + $criteria .= $statement['joiner'].' '.$key.' '.$statement['operator'].' '.$value.' '; |
|
| 589 | 589 | } elseif ($statement['key'] instanceof Raw) { |
| 590 | - $criteria .= $statement['joiner'] . ' ' . $key . ' '; |
|
| 590 | + $criteria .= $statement['joiner'].' '.$key.' '; |
|
| 591 | 591 | $bindings = array_merge($bindings, $statement['key']->getBindings()); |
| 592 | 592 | } else { |
| 593 | 593 | // For wheres |
| 594 | 594 | $bindings[] = $this->getValue($value); |
| 595 | 595 | |
| 596 | - $criteria .= $statement['joiner'] . ' ' . $key . ' ' . $statement['operator'] . ' ' |
|
| 597 | - . $this->getType($value) . ' '; |
|
| 596 | + $criteria .= $statement['joiner'].' '.$key.' '.$statement['operator'].' ' |
|
| 597 | + . $this->getType($value).' '; |
|
| 598 | 598 | } |
| 599 | 599 | } |
| 600 | 600 | } |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | |
| 650 | 650 | foreach ($valueArr as $key => $subValue) { |
| 651 | 651 | // Don't wrap if we have *, which is not a usual field |
| 652 | - $valueArr[$key] = '*' == trim($subValue) ? $subValue : $this->sanitizer . $subValue . $this->sanitizer; |
|
| 652 | + $valueArr[$key] = '*' == trim($subValue) ? $subValue : $this->sanitizer.$subValue.$this->sanitizer; |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | // Join these back with "." and return |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | list($criteria, $bindings) = $this->buildCriteria($statements[$key], $bindValues); |
| 677 | 677 | |
| 678 | 678 | if ($criteria) { |
| 679 | - $criteria = $type . ' ' . $criteria; |
|
| 679 | + $criteria = $type.' '.$criteria; |
|
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | 682 | |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | { |
| 698 | 698 | $sql = ''; |
| 699 | 699 | |
| 700 | - if (!array_key_exists('joins', $statements) || !is_array($statements['joins'])) { |
|
| 700 | + if ( ! array_key_exists('joins', $statements) || ! is_array($statements['joins'])) { |
|
| 701 | 701 | return $sql; |
| 702 | 702 | } |
| 703 | 703 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | if (is_array($joinArr['table'])) { |
| 706 | 706 | $mainTable = $this->stringifyValue($this->wrapSanitizer($joinArr['table'][0])); |
| 707 | 707 | $aliasTable = $this->stringifyValue($this->wrapSanitizer($joinArr['table'][1])); |
| 708 | - $table = $mainTable . ' AS ' . $aliasTable; |
|
| 708 | + $table = $mainTable.' AS '.$aliasTable; |
|
| 709 | 709 | } else { |
| 710 | 710 | $table = $joinArr['table'] instanceof Raw |
| 711 | 711 | ? $this->parseRaw($joinArr['table']) |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | // If supplied value is not an array then make it one |
| 29 | 29 | $single = false; |
| 30 | - if (!is_array($values)) { |
|
| 30 | + if ( ! is_array($values)) { |
|
| 31 | 31 | $values = [$values]; |
| 32 | 32 | // We had single value, so should return a single value |
| 33 | 33 | $single = true; |
@@ -45,20 +45,20 @@ discard block |
||
| 45 | 45 | // If key is not integer, it is likely a alias mapping, |
| 46 | 46 | // so we need to change prefix target |
| 47 | 47 | $target = &$value; |
| 48 | - if (!is_int($key)) { |
|
| 48 | + if ( ! is_int($key)) { |
|
| 49 | 49 | $target = &$key; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Do prefix if the target is an expression or function. |
| 53 | 53 | if ( |
| 54 | - !$tableFieldMix |
|
| 54 | + ! $tableFieldMix |
|
| 55 | 55 | || ( |
| 56 | 56 | is_string($target) // Must be a string |
| 57 | 57 | && (bool) preg_match('/^[A-Za-z0-9_.]+$/', $target) // Can only contain letters, numbers, underscore and full stops |
| 58 | 58 | && 1 === \substr_count($target, '.') // Contains a single full stop ONLY. |
| 59 | 59 | ) |
| 60 | 60 | ) { |
| 61 | - $target = $this->getTablePrefix() . $target; |
|
| 61 | + $target = $this->getTablePrefix().$target; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $return[$key] = $value; |
@@ -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 | /** |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | ->select([$this->raw(sprintf('%s(%s) AS field', strtoupper($type), $field))]) |
| 398 | 398 | ->first(); |
| 399 | 399 | |
| 400 | - return true === isset($count->field) ? (float)$count->field : 0; |
|
| 400 | + return true === isset($count->field) ? (float) $count->field : 0; |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /** |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | */ |
| 414 | 414 | public function count(string $field = '*'): int |
| 415 | 415 | { |
| 416 | - return (int)$this->aggregate('count', $field); |
|
| 416 | + return (int) $this->aggregate('count', $field); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | /** |
@@ -491,8 +491,8 @@ discard block |
||
| 491 | 491 | public function getQuery(string $type = 'select', $dataToBePassed = []) |
| 492 | 492 | { |
| 493 | 493 | $allowedTypes = ['select', 'insert', 'insertignore', 'replace', 'delete', 'update', 'criteriaonly']; |
| 494 | - if (!in_array(strtolower($type), $allowedTypes)) { |
|
| 495 | - throw new Exception($type . ' is not a known type.', 2); |
|
| 494 | + if ( ! in_array(strtolower($type), $allowedTypes)) { |
|
| 495 | + throw new Exception($type.' is not a known type.', 2); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | $queryArr = $this->adapterInstance->$type($this->statements, $dataToBePassed); |
@@ -511,9 +511,9 @@ discard block |
||
| 511 | 511 | */ |
| 512 | 512 | public function subQuery(QueryBuilderHandler $queryBuilder, ?string $alias = null) |
| 513 | 513 | { |
| 514 | - $sql = '(' . $queryBuilder->getQuery()->getRawSql() . ')'; |
|
| 514 | + $sql = '('.$queryBuilder->getQuery()->getRawSql().')'; |
|
| 515 | 515 | if (is_string($alias) && 0 !== mb_strlen($alias)) { |
| 516 | - $sql = $sql . ' as ' . $alias; |
|
| 516 | + $sql = $sql.' as '.$alias; |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | return $queryBuilder->raw($sql); |
@@ -530,12 +530,12 @@ discard block |
||
| 530 | 530 | private function doInsert(array $data, string $type) |
| 531 | 531 | { |
| 532 | 532 | $eventResult = $this->fireEvents('before-insert'); |
| 533 | - if (!is_null($eventResult)) { |
|
| 533 | + if ( ! is_null($eventResult)) { |
|
| 534 | 534 | return $eventResult; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | // If first value is not an array () not a batch insert) |
| 538 | - if (!is_array(current($data))) { |
|
| 538 | + if ( ! is_array(current($data))) { |
|
| 539 | 539 | $queryObject = $this->getQuery($type, $data); |
| 540 | 540 | |
| 541 | 541 | list($preparedQuery, $executionTime) = $this->statement($queryObject->getSql(), $queryObject->getBindings()); |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | public function update($data) |
| 606 | 606 | { |
| 607 | 607 | $eventResult = $this->fireEvents('before-update'); |
| 608 | - if (!is_null($eventResult)) { |
|
| 608 | + if ( ! is_null($eventResult)) { |
|
| 609 | 609 | return $eventResult; |
| 610 | 610 | } |
| 611 | 611 | $queryObject = $this->getQuery('update', $data); |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | public function delete(): int |
| 652 | 652 | { |
| 653 | 653 | $eventResult = $this->fireEvents('before-delete'); |
| 654 | - if (!is_null($eventResult)) { |
|
| 654 | + if ( ! is_null($eventResult)) { |
|
| 655 | 655 | return $eventResult; |
| 656 | 656 | } |
| 657 | 657 | |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | */ |
| 674 | 674 | public function table(...$tables) |
| 675 | 675 | { |
| 676 | - $instance = $this->constructCurrentBuilderClass($this->connection); |
|
| 676 | + $instance = $this->constructCurrentBuilderClass($this->connection); |
|
| 677 | 677 | $this->setFetchMode($this->getFetchMode(), $this->hydratorConstructorArgs); |
| 678 | 678 | $tables = $this->addTablePrefix($tables, false); |
| 679 | 679 | $instance->addStatement('tables', $tables); |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | */ |
| 702 | 702 | public function select($fields): self |
| 703 | 703 | { |
| 704 | - if (!is_array($fields)) { |
|
| 704 | + if ( ! is_array($fields)) { |
|
| 705 | 705 | $fields = func_get_args(); |
| 706 | 706 | } |
| 707 | 707 | |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | */ |
| 763 | 763 | public function orderBy($fields, string $defaultDirection = 'ASC'): self |
| 764 | 764 | { |
| 765 | - if (!is_array($fields)) { |
|
| 765 | + if ( ! is_array($fields)) { |
|
| 766 | 766 | $fields = [$fields]; |
| 767 | 767 | } |
| 768 | 768 | |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | $field = $this->jsonHandler->extractAndUnquoteFromJsonSelector($field); |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | - if (!$field instanceof Raw) { |
|
| 781 | + if ( ! $field instanceof Raw) { |
|
| 782 | 782 | $field = $this->addTablePrefix($field); |
| 783 | 783 | } |
| 784 | 784 | $this->statements['orderBys'][] = compact('field', 'type'); |
@@ -1130,7 +1130,7 @@ discard block |
||
| 1130 | 1130 | throw new Exception('Key used for whereNull condition must be a string or raw exrpession.', 1); |
| 1131 | 1131 | } |
| 1132 | 1132 | |
| 1133 | - return $this->{$operator . 'Where'}($this->raw("{$key} IS{$prefix} NULL")); |
|
| 1133 | + return $this->{$operator.'Where'}($this->raw("{$key} IS{$prefix} NULL")); |
|
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | |
@@ -1227,8 +1227,8 @@ discard block |
||
| 1227 | 1227 | $value = $this->jsonHandler->extractAndUnquoteFromJsonSelector($value); |
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | - if (!$key instanceof Closure) { |
|
| 1231 | - $key = function ($joinBuilder) use ($key, $operator, $value) { |
|
| 1230 | + if ( ! $key instanceof Closure) { |
|
| 1231 | + $key = function($joinBuilder) use ($key, $operator, $value) { |
|
| 1232 | 1232 | $joinBuilder->on($key, $operator, $value); |
| 1233 | 1233 | }; |
| 1234 | 1234 | } |
@@ -1323,7 +1323,7 @@ discard block |
||
| 1323 | 1323 | */ |
| 1324 | 1324 | public function joinUsing(string $table, string $key, string $type = 'INNER'): self |
| 1325 | 1325 | { |
| 1326 | - if (!array_key_exists('tables', $this->statements) || count($this->statements['tables']) !== 1) { |
|
| 1326 | + if ( ! array_key_exists('tables', $this->statements) || count($this->statements['tables']) !== 1) { |
|
| 1327 | 1327 | throw new Exception("JoinUsing can only be used with a single table set as the base of the query", 1); |
| 1328 | 1328 | } |
| 1329 | 1329 | $baseTable = end($this->statements['tables']); |
@@ -1414,11 +1414,11 @@ discard block |
||
| 1414 | 1414 | */ |
| 1415 | 1415 | protected function addStatement($key, $value) |
| 1416 | 1416 | { |
| 1417 | - if (!is_array($value)) { |
|
| 1417 | + if ( ! is_array($value)) { |
|
| 1418 | 1418 | $value = [$value]; |
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | - if (!array_key_exists($key, $this->statements)) { |
|
| 1421 | + if ( ! array_key_exists($key, $this->statements)) { |
|
| 1422 | 1422 | $this->statements[$key] = $value; |
| 1423 | 1423 | } else { |
| 1424 | 1424 | $this->statements[$key] = array_merge($this->statements[$key], $value); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function toJsonSelector(string $expression): JsonSelector |
| 77 | 77 | { |
| 78 | - if (! $this->isJsonSelector($expression)) { |
|
| 78 | + if ( ! $this->isJsonSelector($expression)) { |
|
| 79 | 79 | throw new Exception('JSON expression must contain at least 2 values, the table column and at least 1 node.', 1); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $column = array_shift($parts); |
| 86 | 86 | $nodes = $parts; |
| 87 | 87 | |
| 88 | - if (! is_string($column)) { |
|
| 88 | + if ( ! is_string($column)) { |
|
| 89 | 89 | throw new Exception('JSON expression must contain a valid column name', 1); |
| 90 | 90 | } |
| 91 | 91 | |