@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function __construct() |
38 | 38 | { |
39 | - $this->routePath = __DIR__ . DIRECTORY_SEPARATOR . 'src'; |
|
39 | + $this->routePath = __DIR__.DIRECTORY_SEPARATOR.'src'; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | ); |
65 | 65 | |
66 | 66 | foreach ($rii as $file) { |
67 | - if ($file->isDir() || $file->getPathname() === $this->routePath . DIRECTORY_SEPARATOR . 'loader.php') { |
|
67 | + if ($file->isDir() || $file->getPathname() === $this->routePath.DIRECTORY_SEPARATOR.'loader.php') { |
|
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | // Set all classes to be required last, allow traits to load first. |
92 | - uasort($this->classes, function ($file1, $file2) { |
|
92 | + uasort($this->classes, function($file1, $file2) { |
|
93 | 93 | return is_null($file1['class']) ? -1 : 1; |
94 | 94 | }); |
95 | 95 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | $i++; |
133 | 133 | } |
134 | - if (!$namespace_ok) { |
|
134 | + if ( ! $namespace_ok) { |
|
135 | 135 | return null; |
136 | 136 | } else { |
137 | 137 | return $namespace; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | // Generated code start..."; |
207 | 207 | |
208 | - $contents = array_map(function ($file, $class) { |
|
208 | + $contents = array_map(function($file, $class) { |
|
209 | 209 | return sprintf( |
210 | 210 | "if (!%s(%s::class)) { |
211 | 211 | require_once __DIR__ . '%s'; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | $footer = sprintf("// CREATED ON %s", date('D jS F Y', time())); |
220 | 220 | |
221 | - $file = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'loader.php'; |
|
221 | + $file = __DIR__.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'loader.php'; |
|
222 | 222 | touch($file); |
223 | 223 | |
224 | 224 | file_put_contents( |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | return ''; |
265 | 265 | |
266 | 266 | case ! is_null($token['trait']): |
267 | - return $token['ns'] . '\\' . $token['trait']; |
|
267 | + return $token['ns'].'\\'.$token['trait']; |
|
268 | 268 | |
269 | 269 | case ! is_null($token['interface']): |
270 | - return $token['ns'] . '\\' . $token['interface']; |
|
270 | + return $token['ns'].'\\'.$token['interface']; |
|
271 | 271 | |
272 | 272 | case ! is_null($token['class']): |
273 | - return $token['ns'] . '\\' . $token['class']; |
|
273 | + return $token['ns'].'\\'.$token['class']; |
|
274 | 274 | |
275 | 275 | default: |
276 | 276 | return ''; |
@@ -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($data) |
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); |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | public function delete() |
663 | 663 | { |
664 | 664 | $eventResult = $this->fireEvents('before-delete'); |
665 | - if (!is_null($eventResult)) { |
|
665 | + if ( ! is_null($eventResult)) { |
|
666 | 666 | return $eventResult; |
667 | 667 | } |
668 | 668 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | */ |
685 | 685 | public function table(...$tables) |
686 | 686 | { |
687 | - $instance = $this->constructCurrentBuilderClass($this->connection); |
|
687 | + $instance = $this->constructCurrentBuilderClass($this->connection); |
|
688 | 688 | $this->setFetchMode($this->getFetchMode(), $this->hydratorConstructorArgs); |
689 | 689 | $tables = $this->addTablePrefix($tables, false); |
690 | 690 | $instance->addStatement('tables', $tables); |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | */ |
713 | 713 | public function select($fields): self |
714 | 714 | { |
715 | - if (!is_array($fields)) { |
|
715 | + if ( ! is_array($fields)) { |
|
716 | 716 | $fields = func_get_args(); |
717 | 717 | } |
718 | 718 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | */ |
774 | 774 | public function orderBy($fields, string $defaultDirection = 'ASC'): self |
775 | 775 | { |
776 | - if (!is_array($fields)) { |
|
776 | + if ( ! is_array($fields)) { |
|
777 | 777 | $fields = [$fields]; |
778 | 778 | } |
779 | 779 | |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $field = $this->jsonHandler->extractAndUnquoteFromJsonSelector($field); |
790 | 790 | } |
791 | 791 | |
792 | - if (!$field instanceof Raw) { |
|
792 | + if ( ! $field instanceof Raw) { |
|
793 | 793 | $field = $this->addTablePrefix($field); |
794 | 794 | } |
795 | 795 | $this->statements['orderBys'][] = compact('field', 'type'); |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | throw new Exception('Key used for whereNull condition must be a string or raw exrpession.', 1); |
1142 | 1142 | } |
1143 | 1143 | |
1144 | - return $this->{$operator . 'Where'}($this->raw("{$key} IS{$prefix} NULL")); |
|
1144 | + return $this->{$operator.'Where'}($this->raw("{$key} IS{$prefix} NULL")); |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | |
@@ -1238,8 +1238,8 @@ discard block |
||
1238 | 1238 | $value = $this->jsonHandler->extractAndUnquoteFromJsonSelector($value); |
1239 | 1239 | } |
1240 | 1240 | |
1241 | - if (!$key instanceof Closure) { |
|
1242 | - $key = function ($joinBuilder) use ($key, $operator, $value) { |
|
1241 | + if ( ! $key instanceof Closure) { |
|
1242 | + $key = function($joinBuilder) use ($key, $operator, $value) { |
|
1243 | 1243 | $joinBuilder->on($key, $operator, $value); |
1244 | 1244 | }; |
1245 | 1245 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | */ |
1333 | 1333 | public function joinUsing(string $table, string $key, string $type = 'INNER'): self |
1334 | 1334 | { |
1335 | - if (!array_key_exists('tables', $this->statements) || count($this->statements['tables']) !== 1) { |
|
1335 | + if ( ! array_key_exists('tables', $this->statements) || count($this->statements['tables']) !== 1) { |
|
1336 | 1336 | throw new Exception("JoinUsing can only be used with a single table set as the base of the query", 1); |
1337 | 1337 | } |
1338 | 1338 | $baseTable = end($this->statements['tables']); |
@@ -1423,11 +1423,11 @@ discard block |
||
1423 | 1423 | */ |
1424 | 1424 | protected function addStatement($key, $value) |
1425 | 1425 | { |
1426 | - if (!is_array($value)) { |
|
1426 | + if ( ! is_array($value)) { |
|
1427 | 1427 | $value = [$value]; |
1428 | 1428 | } |
1429 | 1429 | |
1430 | - if (!array_key_exists($key, $this->statements)) { |
|
1430 | + if ( ! array_key_exists($key, $this->statements)) { |
|
1431 | 1431 | $this->statements[$key] = $value; |
1432 | 1432 | } else { |
1433 | 1433 | $this->statements[$key] = array_merge($this->statements[$key], $value); |
@@ -75,7 +75,7 @@ |
||
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 |
@@ -38,12 +38,12 @@ |
||
38 | 38 | protected function normaliseNodes($nodes): string |
39 | 39 | { |
40 | 40 | // If its not an array, cast. |
41 | - if (!is_array($nodes)) { |
|
41 | + if ( ! is_array($nodes)) { |
|
42 | 42 | $nodes = [$nodes]; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Remove all none string. |
46 | - $nodes = array_filter($nodes, function ($node): bool { |
|
46 | + $nodes = array_filter($nodes, function($node): bool { |
|
47 | 47 | return is_string($node); |
48 | 48 | }); |
49 | 49 |
@@ -26,67 +26,67 @@ |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | // Generated code start... |
29 | -if (!trait_exists(Pixie\QueryBuilder\TablePrefixer::class)) { |
|
30 | - require_once __DIR__ . '/QueryBuilder/TablePrefixer.php'; |
|
29 | +if ( ! trait_exists(Pixie\QueryBuilder\TablePrefixer::class)) { |
|
30 | + require_once __DIR__.'/QueryBuilder/TablePrefixer.php'; |
|
31 | 31 | } |
32 | -if (!interface_exists(Pixie\HasConnection::class)) { |
|
33 | - require_once __DIR__ . '/HasConnection.php'; |
|
32 | +if ( ! interface_exists(Pixie\HasConnection::class)) { |
|
33 | + require_once __DIR__.'/HasConnection.php'; |
|
34 | 34 | } |
35 | -if (!class_exists(Pixie\Binding::class)) { |
|
36 | - require_once __DIR__ . '/Binding.php'; |
|
35 | +if ( ! class_exists(Pixie\Binding::class)) { |
|
36 | + require_once __DIR__.'/Binding.php'; |
|
37 | 37 | } |
38 | -if (!class_exists(Pixie\QueryBuilder\QueryBuilderHandler::class)) { |
|
39 | - require_once __DIR__ . '/QueryBuilder/QueryBuilderHandler.php'; |
|
38 | +if ( ! class_exists(Pixie\QueryBuilder\QueryBuilderHandler::class)) { |
|
39 | + require_once __DIR__.'/QueryBuilder/QueryBuilderHandler.php'; |
|
40 | 40 | } |
41 | -if (!class_exists(Pixie\QueryBuilder\Transaction::class)) { |
|
42 | - require_once __DIR__ . '/QueryBuilder/Transaction.php'; |
|
41 | +if ( ! class_exists(Pixie\QueryBuilder\Transaction::class)) { |
|
42 | + require_once __DIR__.'/QueryBuilder/Transaction.php'; |
|
43 | 43 | } |
44 | -if (!class_exists(Pixie\QueryBuilder\Raw::class)) { |
|
45 | - require_once __DIR__ . '/QueryBuilder/Raw.php'; |
|
44 | +if ( ! class_exists(Pixie\QueryBuilder\Raw::class)) { |
|
45 | + require_once __DIR__.'/QueryBuilder/Raw.php'; |
|
46 | 46 | } |
47 | -if (!class_exists(Pixie\JSON\JsonHandler::class)) { |
|
48 | - require_once __DIR__ . '/JSON/JsonHandler.php'; |
|
47 | +if ( ! class_exists(Pixie\JSON\JsonHandler::class)) { |
|
48 | + require_once __DIR__.'/JSON/JsonHandler.php'; |
|
49 | 49 | } |
50 | -if (!class_exists(Pixie\EventHandler::class)) { |
|
51 | - require_once __DIR__ . '/EventHandler.php'; |
|
50 | +if ( ! class_exists(Pixie\EventHandler::class)) { |
|
51 | + require_once __DIR__.'/EventHandler.php'; |
|
52 | 52 | } |
53 | -if (!class_exists(Pixie\QueryBuilder\QueryObject::class)) { |
|
54 | - require_once __DIR__ . '/QueryBuilder/QueryObject.php'; |
|
53 | +if ( ! class_exists(Pixie\QueryBuilder\QueryObject::class)) { |
|
54 | + require_once __DIR__.'/QueryBuilder/QueryObject.php'; |
|
55 | 55 | } |
56 | -if (!class_exists(Pixie\QueryBuilder\JoinBuilder::class)) { |
|
57 | - require_once __DIR__ . '/QueryBuilder/JoinBuilder.php'; |
|
56 | +if ( ! class_exists(Pixie\QueryBuilder\JoinBuilder::class)) { |
|
57 | + require_once __DIR__.'/QueryBuilder/JoinBuilder.php'; |
|
58 | 58 | } |
59 | -if (!class_exists(Pixie\QueryBuilder\NestedCriteria::class)) { |
|
60 | - require_once __DIR__ . '/QueryBuilder/NestedCriteria.php'; |
|
59 | +if ( ! class_exists(Pixie\QueryBuilder\NestedCriteria::class)) { |
|
60 | + require_once __DIR__.'/QueryBuilder/NestedCriteria.php'; |
|
61 | 61 | } |
62 | -if (!class_exists(Pixie\JSON\JsonSelectorHandler::class)) { |
|
63 | - require_once __DIR__ . '/JSON/JsonSelectorHandler.php'; |
|
62 | +if ( ! class_exists(Pixie\JSON\JsonSelectorHandler::class)) { |
|
63 | + require_once __DIR__.'/JSON/JsonSelectorHandler.php'; |
|
64 | 64 | } |
65 | -if (!class_exists(Pixie\JSON\JsonSelector::class)) { |
|
66 | - require_once __DIR__ . '/JSON/JsonSelector.php'; |
|
65 | +if ( ! class_exists(Pixie\JSON\JsonSelector::class)) { |
|
66 | + require_once __DIR__.'/JSON/JsonSelector.php'; |
|
67 | 67 | } |
68 | -if (!class_exists(Pixie\Connection::class)) { |
|
69 | - require_once __DIR__ . '/Connection.php'; |
|
68 | +if ( ! class_exists(Pixie\Connection::class)) { |
|
69 | + require_once __DIR__.'/Connection.php'; |
|
70 | 70 | } |
71 | -if (!class_exists(Pixie\QueryBuilder\JsonQueryBuilder::class)) { |
|
72 | - require_once __DIR__ . '/QueryBuilder/JsonQueryBuilder.php'; |
|
71 | +if ( ! class_exists(Pixie\QueryBuilder\JsonQueryBuilder::class)) { |
|
72 | + require_once __DIR__.'/QueryBuilder/JsonQueryBuilder.php'; |
|
73 | 73 | } |
74 | -if (!class_exists(Pixie\Hydration\Hydrator::class)) { |
|
75 | - require_once __DIR__ . '/Hydration/Hydrator.php'; |
|
74 | +if ( ! class_exists(Pixie\Hydration\Hydrator::class)) { |
|
75 | + require_once __DIR__.'/Hydration/Hydrator.php'; |
|
76 | 76 | } |
77 | -if (!class_exists(Pixie\QueryBuilder\WPDBAdapter::class)) { |
|
78 | - require_once __DIR__ . '/QueryBuilder/WPDBAdapter.php'; |
|
77 | +if ( ! class_exists(Pixie\QueryBuilder\WPDBAdapter::class)) { |
|
78 | + require_once __DIR__.'/QueryBuilder/WPDBAdapter.php'; |
|
79 | 79 | } |
80 | -if (!class_exists(Pixie\Exception::class)) { |
|
81 | - require_once __DIR__ . '/Exception.php'; |
|
80 | +if ( ! class_exists(Pixie\Exception::class)) { |
|
81 | + require_once __DIR__.'/Exception.php'; |
|
82 | 82 | } |
83 | -if (!class_exists(Pixie\QueryBuilder\TransactionHaltException::class)) { |
|
84 | - require_once __DIR__ . '/QueryBuilder/TransactionHaltException.php'; |
|
83 | +if ( ! class_exists(Pixie\QueryBuilder\TransactionHaltException::class)) { |
|
84 | + require_once __DIR__.'/QueryBuilder/TransactionHaltException.php'; |
|
85 | 85 | } |
86 | -if (!class_exists(Pixie\AliasFacade::class)) { |
|
87 | - require_once __DIR__ . '/AliasFacade.php'; |
|
86 | +if ( ! class_exists(Pixie\AliasFacade::class)) { |
|
87 | + require_once __DIR__.'/AliasFacade.php'; |
|
88 | 88 | } |
89 | -if (!class_exists(Pixie\JSON\JsonExpressionFactory::class)) { |
|
90 | - require_once __DIR__ . '/JSON/JsonExpressionFactory.php'; |
|
89 | +if ( ! class_exists(Pixie\JSON\JsonExpressionFactory::class)) { |
|
90 | + require_once __DIR__.'/JSON/JsonExpressionFactory.php'; |
|
91 | 91 | } |
92 | 92 | // CREATED ON Fri 4th February 2022 |