@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct($value, $bindings = array()) |
| 23 | 23 | { |
| 24 | - $this->value = (string)$value; |
|
| 25 | - $this->bindings = (array)$bindings; |
|
| 24 | + $this->value = (string) $value; |
|
| 25 | + $this->bindings = (array) $bindings; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -40,6 +40,6 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function __toString() |
| 42 | 42 | { |
| 43 | - return (string)$this->value; |
|
| 43 | + return (string) $this->value; |
|
| 44 | 44 | } |
| 45 | 45 | } |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function select($statements) |
| 42 | 42 | { |
| 43 | - if (!array_key_exists('tables', $statements)) { |
|
| 43 | + if ( ! array_key_exists('tables', $statements)) { |
|
| 44 | 44 | throw new Exception('No table specified.', 3); |
| 45 | - } elseif (!array_key_exists('selects', $statements)) { |
|
| 45 | + } elseif ( ! array_key_exists('selects', $statements)) { |
|
| 46 | 46 | $statements['selects'][] = '*'; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -57,24 +57,24 @@ discard block |
||
| 57 | 57 | // Group bys |
| 58 | 58 | $groupBys = ''; |
| 59 | 59 | if (isset($statements['groupBys']) && $groupBys = $this->arrayStr($statements['groupBys'], ', ')) { |
| 60 | - $groupBys = 'GROUP BY ' . $groupBys; |
|
| 60 | + $groupBys = 'GROUP BY '.$groupBys; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Order bys |
| 64 | 64 | $orderBys = ''; |
| 65 | 65 | if (isset($statements['orderBys']) && is_array($statements['orderBys'])) { |
| 66 | 66 | foreach ($statements['orderBys'] as $orderBy) { |
| 67 | - $orderBys .= $this->wrapSanitizer($orderBy['field']) . ' ' . $orderBy['type'] . ', '; |
|
| 67 | + $orderBys .= $this->wrapSanitizer($orderBy['field']).' '.$orderBy['type'].', '; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | if ($orderBys = trim($orderBys, ', ')) { |
| 71 | - $orderBys = 'ORDER BY ' . $orderBys; |
|
| 71 | + $orderBys = 'ORDER BY '.$orderBys; |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // Limit and offset |
| 76 | - $limit = isset($statements['limit']) ? 'LIMIT ' . (int) $statements['limit'] : ''; |
|
| 77 | - $offset = isset($statements['offset']) ? 'OFFSET ' . (int) $statements['offset'] : ''; |
|
| 76 | + $limit = isset($statements['limit']) ? 'LIMIT '.(int) $statements['limit'] : ''; |
|
| 77 | + $offset = isset($statements['offset']) ? 'OFFSET '.(int) $statements['offset'] : ''; |
|
| 78 | 78 | |
| 79 | 79 | // Having |
| 80 | 80 | list($havingCriteria, $havingBindings) = $this->buildCriteriaWithType($statements, 'havings', 'HAVING'); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $joinString = $this->buildJoin($statements); |
| 84 | 84 | |
| 85 | 85 | $sqlArray = array( |
| 86 | - 'SELECT' . (isset($statements['distinct']) ? ' DISTINCT' : ''), |
|
| 86 | + 'SELECT'.(isset($statements['distinct']) ? ' DISTINCT' : ''), |
|
| 87 | 87 | $selects, |
| 88 | 88 | 'FROM', |
| 89 | 89 | $tables, |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | public function criteriaOnly($statements, $bindValues = true) |
| 118 | 118 | { |
| 119 | 119 | $sql = $bindings = array(); |
| 120 | - if (!isset($statements['criteria'])) { |
|
| 120 | + if ( ! isset($statements['criteria'])) { |
|
| 121 | 121 | return compact('sql', 'bindings'); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | private function doInsert($statements, array $data, $type) |
| 139 | 139 | { |
| 140 | - if (!isset($statements['tables'])) { |
|
| 140 | + if ( ! isset($statements['tables'])) { |
|
| 141 | 141 | throw new Exception('No table specified', 3); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -150,17 +150,17 @@ discard block |
||
| 150 | 150 | if ($value instanceof Raw) { |
| 151 | 151 | $values[] = (string) $value; |
| 152 | 152 | } else { |
| 153 | - $values[] = $this->inferType($value); |
|
| 153 | + $values[] = $this->inferType($value); |
|
| 154 | 154 | $bindings[] = $value; |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $sqlArray = array( |
| 159 | - $type . ' INTO', |
|
| 159 | + $type.' INTO', |
|
| 160 | 160 | $this->wrapSanitizer($table), |
| 161 | - '(' . $this->arrayStr($keys, ',') . ')', |
|
| 161 | + '('.$this->arrayStr($keys, ',').')', |
|
| 162 | 162 | 'VALUES', |
| 163 | - '(' . $this->arrayStr($values, ',', false) . ')', |
|
| 163 | + '('.$this->arrayStr($values, ',', false).')', |
|
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | 166 | if (isset($statements['onduplicate'])) { |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | throw new Exception('No data given.', 4); |
| 169 | 169 | } |
| 170 | 170 | list($updateStatement, $updateBindings) = $this->getUpdateStatement($statements['onduplicate']); |
| 171 | - $sqlArray[] = 'ON DUPLICATE KEY UPDATE ' . $updateStatement; |
|
| 171 | + $sqlArray[] = 'ON DUPLICATE KEY UPDATE '.$updateStatement; |
|
| 172 | 172 | $bindings = array_merge($bindings, $updateBindings); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | foreach ($data as $key => $value) { |
| 235 | 235 | if ($value instanceof Raw) { |
| 236 | - $statement .= $this->wrapSanitizer($key) . '=' . $value . ','; |
|
| 236 | + $statement .= $this->wrapSanitizer($key).'='.$value.','; |
|
| 237 | 237 | } else { |
| 238 | - $statement .= $this->wrapSanitizer($key) . sprintf('=%s,', $this->inferType($value)); |
|
| 238 | + $statement .= $this->wrapSanitizer($key).sprintf('=%s,', $this->inferType($value)); |
|
| 239 | 239 | $bindings[] = $value; |
| 240 | 240 | } |
| 241 | 241 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | public function update($statements, array $data) |
| 257 | 257 | { |
| 258 | - if (!isset($statements['tables'])) { |
|
| 258 | + if ( ! isset($statements['tables'])) { |
|
| 259 | 259 | throw new Exception('No table specified', 3); |
| 260 | 260 | } elseif (count($data) < 1) { |
| 261 | 261 | throw new Exception('No data given.', 4); |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | list($whereCriteria, $whereBindings) = $this->buildCriteriaWithType($statements, 'wheres', 'WHERE'); |
| 271 | 271 | |
| 272 | 272 | // Limit |
| 273 | - $limit = isset($statements['limit']) ? 'LIMIT ' . $statements['limit'] : ''; |
|
| 273 | + $limit = isset($statements['limit']) ? 'LIMIT '.$statements['limit'] : ''; |
|
| 274 | 274 | |
| 275 | 275 | $sqlArray = array( |
| 276 | 276 | 'UPDATE', |
| 277 | 277 | $this->wrapSanitizer($table), |
| 278 | - 'SET ' . $updateStatement, |
|
| 278 | + 'SET '.$updateStatement, |
|
| 279 | 279 | $whereCriteria, |
| 280 | 280 | $limit |
| 281 | 281 | ); |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | public function delete($statements) |
| 298 | 298 | { |
| 299 | - if (!isset($statements['tables'])) { |
|
| 299 | + if ( ! isset($statements['tables'])) { |
|
| 300 | 300 | throw new Exception('No table specified', 3); |
| 301 | 301 | } |
| 302 | 302 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | list($whereCriteria, $whereBindings) = $this->buildCriteriaWithType($statements, 'wheres', 'WHERE'); |
| 307 | 307 | |
| 308 | 308 | // Limit |
| 309 | - $limit = isset($statements['limit']) ? 'LIMIT ' . $statements['limit'] : ''; |
|
| 309 | + $limit = isset($statements['limit']) ? 'LIMIT '.$statements['limit'] : ''; |
|
| 310 | 310 | |
| 311 | 311 | $sqlArray = array('DELETE FROM', $this->wrapSanitizer($table), $whereCriteria); |
| 312 | 312 | $sql = $this->concatenateQuery($sqlArray); |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | $piece = $this->wrapSanitizer($piece); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if (!is_int($key)) { |
|
| 337 | - $piece = ($wrapSanitizer ? $this->wrapSanitizer($key) : $key) . ' AS ' . $piece; |
|
| 336 | + if ( ! is_int($key)) { |
|
| 337 | + $piece = ($wrapSanitizer ? $this->wrapSanitizer($key) : $key).' AS '.$piece; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - $str .= $piece . $glue; |
|
| 340 | + $str .= $piece.$glue; |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | return trim($str, $glue); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | { |
| 355 | 355 | $str = ''; |
| 356 | 356 | foreach ($pieces as $piece) { |
| 357 | - $str = trim($str) . ' ' . trim($piece); |
|
| 357 | + $str = trim($str).' '.trim($piece); |
|
| 358 | 358 | } |
| 359 | 359 | return trim($str); |
| 360 | 360 | } |
@@ -390,10 +390,10 @@ discard block |
||
| 390 | 390 | // Merge the bindings we get from nestedCriteria object |
| 391 | 391 | $bindings = array_merge($bindings, $queryObject->getBindings()); |
| 392 | 392 | // Append the sql we get from the nestedCriteria object |
| 393 | - $criteria .= $statement['joiner'] . ' (' . $queryObject->getSql() . ') '; |
|
| 393 | + $criteria .= $statement['joiner'].' ('.$queryObject->getSql().') '; |
|
| 394 | 394 | } elseif (is_array($value)) { |
| 395 | 395 | // where_in or between like query |
| 396 | - $criteria .= $statement['joiner'] . ' ' . $key . ' ' . $statement['operator']; |
|
| 396 | + $criteria .= $statement['joiner'].' '.$key.' '.$statement['operator']; |
|
| 397 | 397 | |
| 398 | 398 | switch ($statement['operator']) { |
| 399 | 399 | case 'BETWEEN': |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | $valuePlaceholder = trim($valuePlaceholder, ', '); |
| 416 | - $criteria .= ' (' . $valuePlaceholder . ') '; |
|
| 416 | + $criteria .= ' ('.$valuePlaceholder.') '; |
|
| 417 | 417 | break; |
| 418 | 418 | } |
| 419 | 419 | } elseif ($value instanceof Raw) { |
@@ -421,21 +421,21 @@ discard block |
||
| 421 | 421 | } else { |
| 422 | 422 | // Usual where like criteria |
| 423 | 423 | |
| 424 | - if (!$bindValues) { |
|
| 424 | + if ( ! $bindValues) { |
|
| 425 | 425 | // Specially for joins |
| 426 | 426 | |
| 427 | 427 | // We are not binding values, lets sanitize then |
| 428 | 428 | $value = $this->wrapSanitizer($value); |
| 429 | - $criteria .= $statement['joiner'] . ' ' . $key . ' ' . $statement['operator'] . ' ' . $value . ' '; |
|
| 429 | + $criteria .= $statement['joiner'].' '.$key.' '.$statement['operator'].' '.$value.' '; |
|
| 430 | 430 | } elseif ($statement['key'] instanceof Raw) { |
| 431 | - $criteria .= $statement['joiner'] . ' ' . $key . ' '; |
|
| 431 | + $criteria .= $statement['joiner'].' '.$key.' '; |
|
| 432 | 432 | $bindings = array_merge($bindings, $statement['key']->getBindings()); |
| 433 | 433 | } else { |
| 434 | 434 | // For wheres |
| 435 | 435 | $valuePlaceholder = $this->inferType($value); |
| 436 | 436 | $bindings[] = $value; |
| 437 | - $criteria .= $statement['joiner'] . ' ' . $key . ' ' . $statement['operator'] . ' ' |
|
| 438 | - . $valuePlaceholder . ' '; |
|
| 437 | + $criteria .= $statement['joiner'].' '.$key.' '.$statement['operator'].' ' |
|
| 438 | + . $valuePlaceholder.' '; |
|
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | } |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | { |
| 479 | 479 | // Its a raw query, just cast as string, object has __toString() |
| 480 | 480 | if ($value instanceof Raw) { |
| 481 | - return (string)$value; |
|
| 481 | + return (string) $value; |
|
| 482 | 482 | } elseif ($value instanceof \Closure) { |
| 483 | 483 | return $value; |
| 484 | 484 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | |
| 490 | 490 | foreach ($valueArr as $key => $subValue) { |
| 491 | 491 | // Don't wrap if we have *, which is not a usual field |
| 492 | - $valueArr[$key] = trim($subValue) == '*' ? $subValue : $this->sanitizer . $subValue . $this->sanitizer; |
|
| 492 | + $valueArr[$key] = trim($subValue) == '*' ? $subValue : $this->sanitizer.$subValue.$this->sanitizer; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | // Join these back with "." and return |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | list($criteria, $bindings) = $this->buildCriteria($statements[$key], $bindValues); |
| 517 | 517 | |
| 518 | 518 | if ($criteria) { |
| 519 | - $criteria = $type . ' ' . $criteria; |
|
| 519 | + $criteria = $type.' '.$criteria; |
|
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | { |
| 535 | 535 | $sql = ''; |
| 536 | 536 | |
| 537 | - if (!array_key_exists('joins', $statements) || !is_array($statements['joins'])) { |
|
| 537 | + if ( ! array_key_exists('joins', $statements) || ! is_array($statements['joins'])) { |
|
| 538 | 538 | return $sql; |
| 539 | 539 | } |
| 540 | 540 | |
@@ -542,11 +542,10 @@ discard block |
||
| 542 | 542 | if (is_array($joinArr['table'])) { |
| 543 | 543 | $mainTable = $joinArr['table'][0]; |
| 544 | 544 | $aliasTable = $joinArr['table'][1]; |
| 545 | - $table = $this->wrapSanitizer($mainTable) . ' AS ' . $this->wrapSanitizer($aliasTable); |
|
| 545 | + $table = $this->wrapSanitizer($mainTable).' AS '.$this->wrapSanitizer($aliasTable); |
|
| 546 | 546 | } else { |
| 547 | 547 | $table = $joinArr['table'] instanceof Raw ? |
| 548 | - (string) $joinArr['table'] : |
|
| 549 | - $this->wrapSanitizer($joinArr['table']); |
|
| 548 | + (string) $joinArr['table'] : $this->wrapSanitizer($joinArr['table']); |
|
| 550 | 549 | } |
| 551 | 550 | $joinBuilder = $joinArr['joinBuilder']; |
| 552 | 551 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function __construct($sql, array $bindings, $dbInstance) |
| 24 | 24 | { |
| 25 | - $this->sql = (string)$sql; |
|
| 25 | + $this->sql = (string) $sql; |
|
| 26 | 26 | $this->bindings = $bindings; |
| 27 | 27 | $this->dbInstance = $dbInstance; |
| 28 | 28 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | public function get() |
| 170 | 170 | { |
| 171 | 171 | $eventResult = $this->fireEvents('before-select'); |
| 172 | - if (!is_null($eventResult)) { |
|
| 172 | + if ( ! is_null($eventResult)) { |
|
| 173 | 173 | return $eventResult; |
| 174 | 174 | }; |
| 175 | 175 | $executionTime = 0; |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | ->select([$this->raw(sprintf('%s(%s) AS field', strtoupper($type), $field))]) |
| 281 | 281 | ->first(); |
| 282 | 282 | |
| 283 | - return isset($count->field) === true ? (float)$count->field : 0; |
|
| 283 | + return isset($count->field) === true ? (float) $count->field : 0; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function count(string $field = '*'): int |
| 296 | 296 | { |
| 297 | - return (int)$this->aggregate('count', $field); |
|
| 297 | + return (int) $this->aggregate('count', $field); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /** |
@@ -359,8 +359,8 @@ discard block |
||
| 359 | 359 | public function getQuery($type = 'select', $dataToBePassed = array()) |
| 360 | 360 | { |
| 361 | 361 | $allowedTypes = array('select', 'insert', 'insertignore', 'replace', 'delete', 'update', 'criteriaonly'); |
| 362 | - if (!in_array(strtolower($type), $allowedTypes)) { |
|
| 363 | - throw new Exception($type . ' is not a known type.', 2); |
|
| 362 | + if ( ! in_array(strtolower($type), $allowedTypes)) { |
|
| 363 | + throw new Exception($type.' is not a known type.', 2); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | $queryArr = $this->adapterInstance->$type($this->statements, $dataToBePassed); |
@@ -379,9 +379,9 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | public function subQuery(QueryBuilderHandler $queryBuilder, $alias = null) |
| 381 | 381 | { |
| 382 | - $sql = '(' . $queryBuilder->getQuery()->getRawSql() . ')'; |
|
| 382 | + $sql = '('.$queryBuilder->getQuery()->getRawSql().')'; |
|
| 383 | 383 | if ($alias) { |
| 384 | - $sql = $sql . ' as ' . $alias; |
|
| 384 | + $sql = $sql.' as '.$alias; |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | return $queryBuilder->raw($sql); |
@@ -395,12 +395,12 @@ discard block |
||
| 395 | 395 | private function doInsert($data, $type) |
| 396 | 396 | { |
| 397 | 397 | $eventResult = $this->fireEvents('before-insert'); |
| 398 | - if (!is_null($eventResult)) { |
|
| 398 | + if ( ! is_null($eventResult)) { |
|
| 399 | 399 | return $eventResult; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | // If first value is not an array () not a batch insert) |
| 403 | - if (!is_array(current($data))) { |
|
| 403 | + if ( ! is_array(current($data))) { |
|
| 404 | 404 | $queryObject = $this->getQuery($type, $data); |
| 405 | 405 | |
| 406 | 406 | list($preparedQuery, $executionTime) = $this->statement($queryObject->getSql(), $queryObject->getBindings()); |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | public function update($data) |
| 469 | 469 | { |
| 470 | 470 | $eventResult = $this->fireEvents('before-update'); |
| 471 | - if (!is_null($eventResult)) { |
|
| 471 | + if ( ! is_null($eventResult)) { |
|
| 472 | 472 | return $eventResult; |
| 473 | 473 | } |
| 474 | 474 | |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | public function delete() |
| 515 | 515 | { |
| 516 | 516 | $eventResult = $this->fireEvents('before-delete'); |
| 517 | - if (!is_null($eventResult)) { |
|
| 517 | + if ( ! is_null($eventResult)) { |
|
| 518 | 518 | return $eventResult; |
| 519 | 519 | } |
| 520 | 520 | |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | */ |
| 536 | 536 | public function table($tables) |
| 537 | 537 | { |
| 538 | - if (!is_array($tables)) { |
|
| 538 | + if ( ! is_array($tables)) { |
|
| 539 | 539 | // because a single table is converted to an array anyways, |
| 540 | 540 | // this makes sense. |
| 541 | 541 | $tables = func_get_args(); |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | */ |
| 556 | 556 | public function from($tables) |
| 557 | 557 | { |
| 558 | - if (!is_array($tables)) { |
|
| 558 | + if ( ! is_array($tables)) { |
|
| 559 | 559 | $tables = func_get_args(); |
| 560 | 560 | } |
| 561 | 561 | |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | */ |
| 572 | 572 | public function select($fields) |
| 573 | 573 | { |
| 574 | - if (!is_array($fields)) { |
|
| 574 | + if ( ! is_array($fields)) { |
|
| 575 | 575 | $fields = func_get_args(); |
| 576 | 576 | } |
| 577 | 577 | |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | */ |
| 613 | 613 | public function orderBy($fields, $defaultDirection = 'ASC') |
| 614 | 614 | { |
| 615 | - if (!is_array($fields)) { |
|
| 615 | + if ( ! is_array($fields)) { |
|
| 616 | 616 | $fields = array($fields); |
| 617 | 617 | } |
| 618 | 618 | |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | $field = $value; |
| 624 | 624 | $type = $defaultDirection; |
| 625 | 625 | } |
| 626 | - if (!$field instanceof Raw) { |
|
| 626 | + if ( ! $field instanceof Raw) { |
|
| 627 | 627 | $field = $this->addTablePrefix($field); |
| 628 | 628 | } |
| 629 | 629 | $this->statements['orderBys'][] = compact('field', 'type'); |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | $prefix = \strlen($prefix) === 0 ? '' : " {$prefix}"; |
| 860 | 860 | |
| 861 | 861 | $key = $this->adapterInstance->wrapSanitizer($this->addTablePrefix($key)); |
| 862 | - return $this->{$operator . 'Where'}($this->raw("{$key} IS{$prefix} NULL")); |
|
| 862 | + return $this->{$operator.'Where'}($this->raw("{$key} IS{$prefix} NULL")); |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | /** |
@@ -873,8 +873,8 @@ discard block |
||
| 873 | 873 | */ |
| 874 | 874 | public function join($table, $key, $operator = null, $value = null, $type = 'inner') |
| 875 | 875 | { |
| 876 | - if (!$key instanceof \Closure) { |
|
| 877 | - $key = function ($joinBuilder) use ($key, $operator, $value) { |
|
| 876 | + if ( ! $key instanceof \Closure) { |
|
| 877 | + $key = function($joinBuilder) use ($key, $operator, $value) { |
|
| 878 | 878 | $joinBuilder->on($key, $operator, $value); |
| 879 | 879 | }; |
| 880 | 880 | } |
@@ -1088,7 +1088,7 @@ discard block |
||
| 1088 | 1088 | |
| 1089 | 1089 | // If supplied value is not an array then make it one |
| 1090 | 1090 | $single = false; |
| 1091 | - if (!is_array($values)) { |
|
| 1091 | + if ( ! is_array($values)) { |
|
| 1092 | 1092 | $values = array($values); |
| 1093 | 1093 | // We had single value, so should return a single value |
| 1094 | 1094 | $single = true; |
@@ -1106,12 +1106,12 @@ discard block |
||
| 1106 | 1106 | // If key is not integer, it is likely a alias mapping, |
| 1107 | 1107 | // so we need to change prefix target |
| 1108 | 1108 | $target = &$value; |
| 1109 | - if (!is_int($key)) { |
|
| 1109 | + if ( ! is_int($key)) { |
|
| 1110 | 1110 | $target = &$key; |
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | - if (!$tableFieldMix || ($tableFieldMix && strpos($target, '.') !== false)) { |
|
| 1114 | - $target = $this->tablePrefix . $target; |
|
| 1113 | + if ( ! $tableFieldMix || ($tableFieldMix && strpos($target, '.') !== false)) { |
|
| 1114 | + $target = $this->tablePrefix.$target; |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | $return[$key] = $value; |
@@ -1127,11 +1127,11 @@ discard block |
||
| 1127 | 1127 | */ |
| 1128 | 1128 | protected function addStatement($key, $value) |
| 1129 | 1129 | { |
| 1130 | - if (!is_array($value)) { |
|
| 1130 | + if ( ! is_array($value)) { |
|
| 1131 | 1131 | $value = array($value); |
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | - if (!array_key_exists($key, $this->statements)) { |
|
| 1134 | + if ( ! array_key_exists($key, $this->statements)) { |
|
| 1135 | 1135 | $this->statements[$key] = $value; |
| 1136 | 1136 | } else { |
| 1137 | 1137 | $this->statements[$key] = array_merge($this->statements[$key], $value); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | // Fire before events for :any table |
| 82 | 82 | if ($action = $this->getEvent($event, $table)) { |
| 83 | 83 | // Make an event id, with event type and table |
| 84 | - $eventId = $event . $table; |
|
| 84 | + $eventId = $event.$table; |
|
| 85 | 85 | |
| 86 | 86 | // Fire event |
| 87 | 87 | $handlerParams = func_get_args(); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | // Add to fired list |
| 90 | 90 | $this->firedEvents[] = $eventId; |
| 91 | 91 | $result = call_user_func_array($action, $handlerParams); |
| 92 | - if (!is_null($result)) { |
|
| 92 | + if ( ! is_null($result)) { |
|
| 93 | 93 | return $result; |
| 94 | 94 | }; |
| 95 | 95 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public static function __callStatic($method, $args) |
| 27 | 27 | { |
| 28 | - if (!static::$queryBuilderInstance) { |
|
| 28 | + if ( ! static::$queryBuilderInstance) { |
|
| 29 | 29 | static::$queryBuilderInstance = new QueryBuilderHandler(); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Preserve the first database connection with a static property |
| 67 | - if (! static::$storedConnection) { |
|
| 67 | + if ( ! static::$storedConnection) { |
|
| 68 | 68 | static::$storedConnection = $this; |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function createAlias(string $alias): void |
| 78 | 78 | { |
| 79 | 79 | class_alias(AliasFacade::class, $alias); |
| 80 | - $builder = $this->container->build(QueryBuilderHandler::class, array( $this )); |
|
| 80 | + $builder = $this->container->build(QueryBuilderHandler::class, array($this)); |
|
| 81 | 81 | AliasFacade::setQueryBuilderInstance($builder); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function getQueryBuilder(): QueryBuilderHandler |
| 88 | 88 | { |
| 89 | - return $this->container->build(QueryBuilderHandler::class, array( $this )); |
|
| 89 | + return $this->container->build(QueryBuilderHandler::class, array($this)); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -166,6 +166,6 @@ |
||
| 166 | 166 | { |
| 167 | 167 | return $underscore |
| 168 | 168 | ? "set_{$property}" |
| 169 | - : "set" . \ucfirst($property); |
|
| 169 | + : "set".\ucfirst($property); |
|
| 170 | 170 | } |
| 171 | 171 | } |