@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | protected function creating() |
| 30 | 30 | { |
| 31 | - return collect($this->commands)->contains(function ($command) { |
|
| 31 | + return collect($this->commands)->contains(function($command) { |
|
| 32 | 32 | return $command->name === 'create'; |
| 33 | 33 | }); |
| 34 | 34 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public function executeCreateCommand($command) |
| 37 | 37 | { |
| 38 | 38 | if ($this->connection->pretending()) { |
| 39 | - $this->connection->logQuery('/* ' . $command->explanation . " */\n", []); |
|
| 39 | + $this->connection->logQuery('/* '.$command->explanation." */\n", []); |
|
| 40 | 40 | |
| 41 | 41 | return; |
| 42 | 42 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $collections = $this->collectionHandler->getAllCollections(['excludeSystem' => true]); |
| 52 | - if (! isset($collections[$this->table])) { |
|
| 52 | + if (!isset($collections[$this->table])) { |
|
| 53 | 53 | $this->collectionHandler->create($this->table, $options); |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | public function executeIndexCommand($command) |
| 151 | 151 | { |
| 152 | 152 | if ($this->connection->pretending()) { |
| 153 | - $this->connection->logQuery('/* ' . $command->explanation . " */\n", []); |
|
| 153 | + $this->connection->logQuery('/* '.$command->explanation." */\n", []); |
|
| 154 | 154 | |
| 155 | 155 | return; |
| 156 | 156 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | $parameters['name'] = 'dropIndex'; |
| 181 | 181 | $parameters['index'] = $name; |
| 182 | - $parameters['explanation'] = "Drop the '" . $name . "' index on the {$this->table} table."; |
|
| 182 | + $parameters['explanation'] = "Drop the '".$name."' index on the {$this->table} table."; |
|
| 183 | 183 | $parameters['handler'] = 'collection'; |
| 184 | 184 | |
| 185 | 185 | return $this->addCommand('dropIndex', $parameters); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | public function executeDropIndexCommand($command) |
| 194 | 194 | { |
| 195 | 195 | if ($this->connection->pretending()) { |
| 196 | - $this->connection->logQuery('/* ' . $command->explanation . " */\n", []); |
|
| 196 | + $this->connection->logQuery('/* '.$command->explanation." */\n", []); |
|
| 197 | 197 | |
| 198 | 198 | return; |
| 199 | 199 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function createIndexName($type, array $columns) |
| 228 | 228 | { |
| 229 | - $index = strtolower($this->prefix . $this->table . '_' . implode('_', $columns) . '_' . $type); |
|
| 229 | + $index = strtolower($this->prefix.$this->table.'_'.implode('_', $columns).'_'.$type); |
|
| 230 | 230 | $index = preg_replace("/\[\*+\]+/", '_array', $index); |
| 231 | 231 | |
| 232 | 232 | return preg_replace('/[^A-Za-z0-9]+/', '_', $index); |
@@ -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 | } |
@@ -32,10 +32,10 @@ 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 | - $aqb = AQB::for('doc', $collection) |
|
| 38 | + $aqb = AQB::for ('doc', $collection) |
|
| 39 | 39 | ->filter($filter) |
| 40 | 40 | ->limit(1) |
| 41 | 41 | ->return('true') |
@@ -61,17 +61,17 @@ discard block |
||
| 61 | 61 | $bindings['to'] = $this->wrapBindVar($command->from); |
| 62 | 62 | |
| 63 | 63 | $filter = [ |
| 64 | - ['doc.' . $command->from, '!=', 'null'], |
|
| 65 | - ['doc.' . $command->to], |
|
| 64 | + ['doc.'.$command->from, '!=', 'null'], |
|
| 65 | + ['doc.'.$command->to], |
|
| 66 | 66 | ]; |
| 67 | 67 | |
| 68 | - $aqb = AQB::for('doc', $collection) |
|
| 68 | + $aqb = AQB::for ('doc', $collection) |
|
| 69 | 69 | ->filter($filter) |
| 70 | 70 | ->update( |
| 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,10 +99,10 @@ 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 | - $aqb = AQB::for('doc', $collection) |
|
| 105 | + $aqb = AQB::for ('doc', $collection) |
|
| 106 | 106 | ->filter($filter) |
| 107 | 107 | ->update('doc', $data, $collection) |
| 108 | 108 | ->options(['keepNull' => false]) |
@@ -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 | } |
@@ -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 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function registerAlias(string $table, string $alias): void |
| 211 | 211 | { |
| 212 | - if (! isset($this->aliasRegistry[$table])) { |
|
| 212 | + if (!isset($this->aliasRegistry[$table])) { |
|
| 213 | 213 | $this->aliasRegistry[$table] = $alias; |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $this->aqb = new QueryBuilder(); |
| 243 | 243 | |
| 244 | - if (! $results->isEmpty()) { |
|
| 244 | + if (!$results->isEmpty()) { |
|
| 245 | 245 | return array_change_key_case((array) $results[0])['aggregate']; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | 'boolean' |
| 323 | 323 | ); |
| 324 | 324 | |
| 325 | - if (! $value instanceof Expression) { |
|
| 325 | + if (!$value instanceof Expression) { |
|
| 326 | 326 | $this->addBinding($value, 'where'); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -358,8 +358,8 @@ discard block |
||
| 358 | 358 | */ |
| 359 | 359 | protected function invalidOperator($operator) |
| 360 | 360 | { |
| 361 | - return ! in_array(strtolower($operator), $this->operators, true) && |
|
| 362 | - ! isset($this->grammar->getOperators()[strtoupper($operator)]); |
|
| 361 | + return !in_array(strtolower($operator), $this->operators, true) && |
|
| 362 | + !isset($this->grammar->getOperators()[strtoupper($operator)]); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | if ($this->isQueryable($column)) { |
| 390 | 390 | [$query, $bindings] = $this->createSub($column); |
| 391 | 391 | |
| 392 | - $column = new Expression('(' . $query . ')'); |
|
| 392 | + $column = new Expression('('.$query.')'); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [ |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | protected function generateTableAlias($builder, $table, $postfix = 'Doc') |
| 94 | 94 | { |
| 95 | - $builder->registerAlias($table, Str::singular($table) . $postfix); |
|
| 95 | + $builder->registerAlias($table, Str::singular($table).$postfix); |
|
| 96 | 96 | |
| 97 | 97 | return $builder; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | protected function prefixTable($table) |
| 101 | 101 | { |
| 102 | - return $this->tablePrefix . $table; |
|
| 102 | + return $this->tablePrefix.$table; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function compileInsert(Builder $builder, array $values) |
| 114 | 114 | { |
| 115 | - if (! is_array(reset($values))) { |
|
| 115 | + if (!is_array(reset($values))) { |
|
| 116 | 116 | $values = [$values]; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | // see if that component exists. If it does we'll just call the compiler |
| 187 | 187 | // function for the component which is responsible for making the SQL. |
| 188 | 188 | |
| 189 | - if (isset($builder->$component) && ! is_null($builder->$component)) { |
|
| 190 | - $method = 'compile' . ucfirst($component); |
|
| 189 | + if (isset($builder->$component) && !is_null($builder->$component)) { |
|
| 190 | + $method = 'compile'.ucfirst($component); |
|
| 191 | 191 | |
| 192 | 192 | $builder = $this->$method($builder, $builder->$component); |
| 193 | 193 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | protected function compileWheresToArray($builder) |
| 248 | 248 | { |
| 249 | - $result = collect($builder->wheres)->map(function ($where) use ($builder) { |
|
| 249 | + $result = collect($builder->wheres)->map(function($where) use ($builder) { |
|
| 250 | 250 | if (isset($where['operator'])) { |
| 251 | 251 | $where['operator'] = $this->translateOperator($where['operator']); |
| 252 | 252 | } else { |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | protected function compileAggregate(Builder $builder, $aggregate) |
| 285 | 285 | { |
| 286 | - $method = 'compile' . ucfirst($aggregate['function']); |
|
| 286 | + $method = 'compile'.ucfirst($aggregate['function']); |
|
| 287 | 287 | |
| 288 | 288 | return $this->$method($builder, $aggregate); |
| 289 | 289 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | protected function compileOrders(Builder $builder, $orders) |
| 376 | 376 | { |
| 377 | - if (! empty($orders)) { |
|
| 377 | + if (!empty($orders)) { |
|
| 378 | 378 | $builder->aqb = $builder->aqb->sort($this->compileOrdersToArray($builder, $orders)); |
| 379 | 379 | |
| 380 | 380 | return $builder; |
@@ -392,8 +392,8 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | protected function compileOrdersToArray(Builder $builder, $orders) |
| 394 | 394 | { |
| 395 | - return array_map(function ($order) use ($builder) { |
|
| 396 | - if (! isset($order['type']) || $order['type'] != 'Raw') { |
|
| 395 | + return array_map(function($order) use ($builder) { |
|
| 396 | + if (!isset($order['type']) || $order['type'] != 'Raw') { |
|
| 397 | 397 | $order['column'] = $this->prefixAlias($builder, $builder->from, $order['column']); |
| 398 | 398 | } |
| 399 | 399 | unset($order['type']); |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $doc = $builder->getAlias($builder->from); |
| 451 | 451 | foreach ($columns as $column) { |
| 452 | 452 | if ($column != null && $column != '*') { |
| 453 | - $values[$column] = $doc . '.' . $column; |
|
| 453 | + $values[$column] = $doc.'.'.$column; |
|
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | 456 | if ($builder->aggregate !== null) { |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | $builder = $this->generateTableAlias($builder, $table); |
| 501 | 501 | $tableAlias = $builder->getAlias($table); |
| 502 | 502 | |
| 503 | - if (! is_null($_key)) { |
|
| 503 | + if (!is_null($_key)) { |
|
| 504 | 504 | $builder->aqb = $builder->aqb->remove((string) $_key, $table)->get(); |
| 505 | 505 | |
| 506 | 506 | return $builder; |
@@ -561,10 +561,10 @@ discard block |
||
| 561 | 561 | { |
| 562 | 562 | $alias = $builder->getAlias($target); |
| 563 | 563 | |
| 564 | - if (Str::startsWith($value, $alias . '.')) { |
|
| 564 | + if (Str::startsWith($value, $alias.'.')) { |
|
| 565 | 565 | return $value; |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | - return $alias . '.' . $value; |
|
| 568 | + return $alias.'.'.$value; |
|
| 569 | 569 | } |
| 570 | 570 | } |
@@ -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 | |