@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | $parameters = []; |
18 | 18 | $parameters['handler'] = 'aql'; |
19 | - $parameters['explanation'] = "Checking if any document within the table has the '" . implode(', ', (array) $column) . "' column(s)."; |
|
19 | + $parameters['explanation'] = "Checking if any document within the table has the '".implode(', ', (array) $column)."' column(s)."; |
|
20 | 20 | $parameters['column'] = $column; |
21 | 21 | |
22 | 22 | return $this->addCommand('hasAttribute', $parameters); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $parameters = []; |
54 | 54 | $parameters['handler'] = 'aql'; |
55 | 55 | $parameters['attributes'] = $columns; |
56 | - $parameters['explanation'] = 'Drop the following column(s): ' . implode(',', $columns) . '.'; |
|
56 | + $parameters['explanation'] = 'Drop the following column(s): '.implode(',', $columns).'.'; |
|
57 | 57 | |
58 | 58 | return $this->addCommand('dropAttribute', compact('parameters')); |
59 | 59 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $this->prefix = $prefix; |
110 | 110 | |
111 | - if (! is_null($callback)) { |
|
111 | + if (!is_null($callback)) { |
|
112 | 112 | $callback($this); |
113 | 113 | } |
114 | 114 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | { |
125 | 125 | $this->connection = $connection; |
126 | 126 | |
127 | - if (! isset($grammar)) { |
|
127 | + if (!isset($grammar)) { |
|
128 | 128 | $this->grammar = $connection->getSchemaGrammar(); |
129 | 129 | } |
130 | 130 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function compileAqlCommand($command) |
147 | 147 | { |
148 | - $compileMethod = 'compile' . ucfirst($command->name); |
|
148 | + $compileMethod = 'compile'.ucfirst($command->name); |
|
149 | 149 | if (method_exists($this->grammar, $compileMethod)) { |
150 | 150 | return $this->grammar->$compileMethod($this->table, $command); |
151 | 151 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function executeCommand($command) |
160 | 160 | { |
161 | - $executeNamedMethod = 'execute' . ucfirst($command->name) . 'Command'; |
|
162 | - $executeHandlerMethod = 'execute' . ucfirst($command->handler) . 'Command'; |
|
161 | + $executeNamedMethod = 'execute'.ucfirst($command->name).'Command'; |
|
162 | + $executeHandlerMethod = 'execute'.ucfirst($command->handler).'Command'; |
|
163 | 163 | if (method_exists($this, $executeNamedMethod)) { |
164 | 164 | $this->$executeNamedMethod($command); |
165 | 165 | } elseif (method_exists($this, $executeHandlerMethod)) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | public function executeCollectionCommand($command) |
181 | 181 | { |
182 | 182 | if ($this->connection->pretending()) { |
183 | - $this->connection->logQuery('/* ' . $command->explanation . " */\n", []); |
|
183 | + $this->connection->logQuery('/* '.$command->explanation." */\n", []); |
|
184 | 184 | |
185 | 185 | return; |
186 | 186 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | public function executeIgnoreCommand($command) |
200 | 200 | { |
201 | 201 | if ($this->connection->pretending()) { |
202 | - $this->connection->logQuery('/* ' . $command->explanation . " */\n", []); |
|
202 | + $this->connection->logQuery('/* '.$command->explanation." */\n", []); |
|
203 | 203 | |
204 | 204 | return; |
205 | 205 | } |
@@ -24,9 +24,9 @@ |
||
24 | 24 | protected function getStub() |
25 | 25 | { |
26 | 26 | if ($this->option('pivot')) { |
27 | - return __DIR__ . '/stubs/pivot.model.stub'; |
|
27 | + return __DIR__.'/stubs/pivot.model.stub'; |
|
28 | 28 | } |
29 | 29 | |
30 | - return __DIR__ . '/stubs/model.stub'; |
|
30 | + return __DIR__.'/stubs/model.stub'; |
|
31 | 31 | } |
32 | 32 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $this->beginTransaction(); |
31 | 31 | |
32 | - return tap($callback($this), function () use ($options, $attempts) { |
|
32 | + return tap($callback($this), function() use ($options, $attempts) { |
|
33 | 33 | $this->commit($options, $attempts); |
34 | 34 | }); |
35 | 35 | } |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | // $query = addslashes($query); |
82 | - $jsCommand = 'db._query(aql`' . $query . '`'; |
|
83 | - if (! empty($bindings)) { |
|
82 | + $jsCommand = 'db._query(aql`'.$query.'`'; |
|
83 | + if (!empty($bindings)) { |
|
84 | 84 | $bindings = json_encode($bindings); |
85 | - $jsCommand .= ', ' . $bindings; |
|
85 | + $jsCommand .= ', '.$bindings; |
|
86 | 86 | } |
87 | 87 | $jsCommand .= ');'; |
88 | 88 | $command = new IlluminateFluent([ |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function commit($options = [], $attempts = 1) |
211 | 211 | { |
212 | - if (! $this->transactions > 0) { |
|
212 | + if (!$this->transactions > 0) { |
|
213 | 213 | throw new \Exception('Transaction committed before starting one.'); |
214 | 214 | } |
215 | - if (! isset($this->transactionCommands[$this->transactions]) || empty($this->transactionCommands[$this->transactions])) { |
|
215 | + if (!isset($this->transactionCommands[$this->transactions]) || empty($this->transactionCommands[$this->transactions])) { |
|
216 | 216 | throw new \Exception('Cannot commit an empty transaction.'); |
217 | 217 | } |
218 | 218 |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | // Add database driver. |
40 | 40 | $this->app->resolving( |
41 | 41 | 'db', |
42 | - function ($db) { |
|
42 | + function($db) { |
|
43 | 43 | $db->extend( |
44 | 44 | 'arangodb', |
45 | - function ($config, $name) { |
|
45 | + function($config, $name) { |
|
46 | 46 | $config['name'] = $name; |
47 | 47 | $connection = new Connection($config); |
48 | 48 | $connection->setSchemaGrammar(new SchemaGrammar()); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | ); |
55 | 55 | |
56 | 56 | $this->app->resolving( |
57 | - function ($app) { |
|
57 | + function($app) { |
|
58 | 58 | if (class_exists('Illuminate\Foundation\AliasLoader')) { |
59 | 59 | $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
60 | 60 | $loader->alias('Eloquent', 'LaravelFreelancerNL\Aranguent\Eloquent\Model'); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $filter = []; |
34 | 34 | foreach ($command->attribute as $attribute) { |
35 | - $filter[] = ['doc.' . $attribute, '!=', null]; |
|
35 | + $filter[] = ['doc.'.$attribute, '!=', null]; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $aqb = (new QueryBuilder())->for('doc', $collection) |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $bindings['to'] = $this->wrapBindVar($command->from); |
62 | 62 | |
63 | 63 | $filter = [ |
64 | - ['doc.' . $command->from, '!=', null], |
|
65 | - ['doc.' . $command->to, '==', null], |
|
64 | + ['doc.'.$command->from, '!=', null], |
|
65 | + ['doc.'.$command->to, '==', null], |
|
66 | 66 | ]; |
67 | 67 | |
68 | 68 | $aqb = (new QueryBuilder())->for('doc', $collection) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | 'doc', |
72 | 72 | [ |
73 | 73 | $command->from => null, |
74 | - $command->to => 'doc.' . $command->from, |
|
74 | + $command->to => 'doc.'.$command->from, |
|
75 | 75 | ], |
76 | 76 | $collection |
77 | 77 | ) |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $data = []; |
101 | 101 | foreach ($command->attributes as $attribute) { |
102 | - $filter[] = ['doc.' . $attribute, '!=', null, 'OR']; |
|
102 | + $filter[] = ['doc.'.$attribute, '!=', null, 'OR']; |
|
103 | 103 | $data[$attribute] = null; |
104 | 104 | } |
105 | 105 | $aqb = (new QueryBuilder())->for('doc', $collection) |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->connection = $connection; |
58 | 58 | $this->grammar = $grammar ?: $connection->getQueryGrammar(); |
59 | 59 | $this->processor = $processor ?: $connection->getPostProcessor(); |
60 | - if (! $aqb instanceof QueryBuilder) { |
|
60 | + if (!$aqb instanceof QueryBuilder) { |
|
61 | 61 | $aqb = new QueryBuilder(); |
62 | 62 | } |
63 | 63 | $this->aqb = $aqb; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function get($columns = ['*']) |
170 | 170 | { |
171 | - $results = collect($this->onceWithColumns(Arr::wrap($columns), function () { |
|
171 | + $results = collect($this->onceWithColumns(Arr::wrap($columns), function() { |
|
172 | 172 | return $this->runSelect(); |
173 | 173 | })); |
174 | 174 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function generateTableAlias($table, $postfix = 'Doc') |
213 | 213 | { |
214 | - $alias = Str::singular($table) . $postfix; |
|
214 | + $alias = Str::singular($table).$postfix; |
|
215 | 215 | $this->registerAlias($table, $alias); |
216 | 216 | |
217 | 217 | return $alias; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function registerAlias(string $table, string $alias): void |
225 | 225 | { |
226 | - if (! isset($this->aliasRegistry[$table])) { |
|
226 | + if (!isset($this->aliasRegistry[$table])) { |
|
227 | 227 | $this->aliasRegistry[$table] = $alias; |
228 | 228 | } |
229 | 229 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | $this->aqb = new QueryBuilder(); |
273 | 273 | |
274 | - if (! $results->isEmpty()) { |
|
274 | + if (!$results->isEmpty()) { |
|
275 | 275 | return array_change_key_case((array) $results[0])['aggregate']; |
276 | 276 | } |
277 | 277 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | 'boolean' |
352 | 352 | ); |
353 | 353 | |
354 | - if (! $value instanceof Expression) { |
|
354 | + if (!$value instanceof Expression) { |
|
355 | 355 | $this->addBinding($value, 'where'); |
356 | 356 | } |
357 | 357 | |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | */ |
388 | 388 | protected function invalidOperator($operator) |
389 | 389 | { |
390 | - return ! in_array(strtolower($operator), $this->operators, true) && |
|
391 | - ! isset($this->grammar->getOperators()[strtoupper($operator)]); |
|
390 | + return !in_array(strtolower($operator), $this->operators, true) && |
|
391 | + !isset($this->grammar->getOperators()[strtoupper($operator)]); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | if ($this->isQueryable($column)) { |
467 | 467 | [$query, $bindings] = $this->createSub($column); |
468 | 468 | |
469 | - $column = new Expression('(' . $query . ')'); |
|
469 | + $column = new Expression('('.$query.')'); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [ |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | */ |
95 | 95 | protected function generateTableAlias($builder, $table, $postfix = 'Doc') |
96 | 96 | { |
97 | - $builder->registerAlias($table, Str::singular($table) . $postfix); |
|
97 | + $builder->registerAlias($table, Str::singular($table).$postfix); |
|
98 | 98 | |
99 | 99 | return $builder; |
100 | 100 | } |
101 | 101 | |
102 | 102 | protected function prefixTable($table) |
103 | 103 | { |
104 | - return $this->tablePrefix . $table; |
|
104 | + return $this->tablePrefix.$table; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | // see if that component exists. If it does we'll just call the compiler |
188 | 188 | // function for the component which is responsible for making the SQL. |
189 | 189 | |
190 | - if (isset($builder->$component) && ! is_null($builder->$component)) { |
|
191 | - $method = 'compile' . ucfirst($component); |
|
190 | + if (isset($builder->$component) && !is_null($builder->$component)) { |
|
191 | + $method = 'compile'.ucfirst($component); |
|
192 | 192 | |
193 | 193 | $builder = $this->$method($builder, $builder->$component); |
194 | 194 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | protected function compileJoins(Builder $builder, $joins) |
226 | 226 | { |
227 | 227 | foreach ($joins as $join) { |
228 | - $compileMethod = 'compile' . ucfirst($join->type) . 'Join'; |
|
228 | + $compileMethod = 'compile'.ucfirst($join->type).'Join'; |
|
229 | 229 | $builder = $this->$compileMethod($builder, $join); |
230 | 230 | } |
231 | 231 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | protected function compileWheresToArray($builder) |
324 | 324 | { |
325 | - $result = collect($builder->wheres)->map(function ($where) use ($builder) { |
|
325 | + $result = collect($builder->wheres)->map(function($where) use ($builder) { |
|
326 | 326 | |
327 | 327 | if (isset($where['operator'])) { |
328 | 328 | $where['operator'] = $this->translateOperator($where['operator']); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } else { |
337 | 337 | $where['column'] = $this->prefixAlias($builder, $builder->from, $where['column']); |
338 | 338 | } |
339 | - $cleanWhere[0] = $where['column'] ; |
|
339 | + $cleanWhere[0] = $where['column']; |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | if (isset($where['first'])) { |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | protected function compileAggregate(Builder $builder, $aggregate) |
373 | 373 | { |
374 | - $method = 'compile' . ucfirst($aggregate['function']); |
|
374 | + $method = 'compile'.ucfirst($aggregate['function']); |
|
375 | 375 | |
376 | 376 | return $this->$method($builder, $aggregate); |
377 | 377 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | */ |
463 | 463 | protected function compileOrders(Builder $builder, $orders) |
464 | 464 | { |
465 | - if (! empty($orders)) { |
|
465 | + if (!empty($orders)) { |
|
466 | 466 | $orders = $this->compileOrdersToFlatArray($builder, $orders); |
467 | 467 | $builder->aqb = $builder->aqb->sort(...$orders); |
468 | 468 | |
@@ -484,14 +484,14 @@ discard block |
||
484 | 484 | $flatOrders = []; |
485 | 485 | |
486 | 486 | foreach ($orders as $order) { |
487 | - if (! isset($order['type']) || $order['type'] != 'Raw') { |
|
487 | + if (!isset($order['type']) || $order['type'] != 'Raw') { |
|
488 | 488 | $order['column'] = $this->prefixAlias($builder, $builder->from, $order['column']); |
489 | 489 | } |
490 | 490 | |
491 | - $flatOrders[] = $order['column'] ; |
|
491 | + $flatOrders[] = $order['column']; |
|
492 | 492 | |
493 | 493 | if (isset($order['direction'])) { |
494 | - $flatOrders[] = $order['direction'] ; |
|
494 | + $flatOrders[] = $order['direction']; |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $doc = $builder->getAlias($builder->from); |
547 | 547 | foreach ($columns as $column) { |
548 | 548 | if ($column != null && $column != '*') { |
549 | - $values[$column] = $doc . '.' . $column; |
|
549 | + $values[$column] = $doc.'.'.$column; |
|
550 | 550 | } |
551 | 551 | } |
552 | 552 | if ($builder->aggregate !== null) { |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | if (empty($values)) { |
557 | 557 | $values = $doc; |
558 | - if (is_array($builder->joins) && ! empty($builder->joins)) { |
|
558 | + if (is_array($builder->joins) && !empty($builder->joins)) { |
|
559 | 559 | $values = $this->mergeJoinResults($builder, $values); |
560 | 560 | } |
561 | 561 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | $builder = $this->generateTableAlias($builder, $table); |
613 | 613 | $tableAlias = $builder->getAlias($table); |
614 | 614 | |
615 | - if (! is_null($_key)) { |
|
615 | + if (!is_null($_key)) { |
|
616 | 616 | $builder->aqb = $builder->aqb->remove((string) $_key, $table)->get(); |
617 | 617 | |
618 | 618 | return $builder; |
@@ -673,10 +673,10 @@ discard block |
||
673 | 673 | { |
674 | 674 | $alias = $builder->getAlias($target); |
675 | 675 | |
676 | - if (Str::startsWith($value, $alias . '.')) { |
|
676 | + if (Str::startsWith($value, $alias.'.')) { |
|
677 | 677 | return $value; |
678 | 678 | } |
679 | 679 | |
680 | - return $alias . '.' . $value; |
|
680 | + return $alias.'.'.$value; |
|
681 | 681 | } |
682 | 682 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | protected function updateTimestamps(array $values) |
64 | 64 | { |
65 | 65 | if ( |
66 | - ! $this->model->usesTimestamps() || |
|
66 | + !$this->model->usesTimestamps() || |
|
67 | 67 | is_null($this->model->getUpdatedAtColumn()) || |
68 | 68 | is_null($this->model->getCreatedAtColumn()) |
69 | 69 | ) { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $timestamps[$updatedAtColumn] = $timestamp; |
75 | 75 | |
76 | 76 | $createdAtColumn = $this->model->getCreatedAtColumn(); |
77 | - if (! isset($values[$createdAtColumn]) && ! isset($this->model->$createdAtColumn)) { |
|
77 | + if (!isset($values[$createdAtColumn]) && !isset($this->model->$createdAtColumn)) { |
|
78 | 78 | $timestamps[$createdAtColumn] = $timestamp; |
79 | 79 | } |
80 | 80 |