@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | 22 | $this->publishes([ |
| 23 | - __DIR__.'/../config/dynamodb.php' => app()->basePath('config/dynamodb.php'), |
|
| 23 | + __DIR__ . '/../config/dynamodb.php' => app()->basePath('config/dynamodb.php'), |
|
| 24 | 24 | ]); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | 'nullify_invalid' => true, |
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | - $this->app->singleton(DynamoDbClientInterface::class, function () use ($marshalerOptions) { |
|
| 36 | + $this->app->singleton(DynamoDbClientInterface::class, function() use ($marshalerOptions) { |
|
| 37 | 37 | $client = new DynamoDbClientService(new Marshaler($marshalerOptions), new EmptyAttributeFilter()); |
| 38 | 38 | |
| 39 | 39 | return $client; |
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | - $this->app->singleton('dynamodb', function () { |
|
| 42 | + $this->app->singleton('dynamodb', function() { |
|
| 43 | 43 | return new DynamoDbManager(app(DynamoDbClientInterface::class)); |
| 44 | 44 | }); |
| 45 | 45 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $keyConditions = $this->keyConditions() ?: []; |
| 92 | 92 | |
| 93 | - return array_filter($this->conditions, function ($condition) use ($keyConditions) { |
|
| 93 | + return array_filter($this->conditions, function($condition) use ($keyConditions) { |
|
| 94 | 94 | return array_search($condition, $keyConditions) === false; |
| 95 | 95 | }); |
| 96 | 96 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $conditions = $this->getConditions($keyNames); |
| 103 | 103 | |
| 104 | - if (! $this->hasValidQueryOperator(...$keyNames)) { |
|
| 104 | + if (!$this->hasValidQueryOperator(...$keyNames)) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $idConditions = $this->identifierConditions(); |
| 114 | 114 | |
| 115 | - if (! $idConditions) { |
|
| 115 | + if (!$idConditions) { |
|
| 116 | 116 | return []; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | private function getCondition($column) |
| 134 | 134 | { |
| 135 | - return H::array_first($this->conditions, function ($condition) use ($column) { |
|
| 135 | + return H::array_first($this->conditions, function($condition) use ($column) { |
|
| 136 | 136 | return $condition['column'] === $column; |
| 137 | 137 | }); |
| 138 | 138 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | private function getConditions($columns) |
| 146 | 146 | { |
| 147 | - return array_filter($this->conditions, function ($condition) use ($columns) { |
|
| 147 | + return array_filter($this->conditions, function($condition) use ($columns) { |
|
| 148 | 148 | return in_array($condition['column'], $columns); |
| 149 | 149 | }); |
| 150 | 150 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $keys = array_values($keysInfo); |
| 166 | 166 | |
| 167 | 167 | if (count(array_intersect($conditionKeys, $keys)) === count($keys)) { |
| 168 | - if (! isset($this->indexName) || $this->indexName === $name) { |
|
| 168 | + if (!isset($this->indexName) || $this->indexName === $name) { |
|
| 169 | 169 | $index = new Index( |
| 170 | 170 | $name, |
| 171 | 171 | Arr::get($keysInfo, 'hash'), |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if ($index && ! $this->hasValidQueryOperator($index->hash, $index->range)) { |
|
| 180 | + if ($index && !$this->hasValidQueryOperator($index->hash, $index->range)) { |
|
| 181 | 181 | $index = null; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | // If the given operator is not found in the list of valid operators we will |
| 237 | 237 | // assume that the developer is just short-cutting the '=' operators and |
| 238 | 238 | // we will set the operators to '=' and set the values appropriately. |
| 239 | - if (! ComparisonOperator::isValidOperator($operator)) { |
|
| 239 | + if (!ComparisonOperator::isValidOperator($operator)) { |
|
| 240 | 240 | [$value, $operator] = [$operator, '=']; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | while (true) { |
| 432 | 432 | $results = $this->getAll([], $chunkSize, false); |
| 433 | 433 | |
| 434 | - if (! $results->isEmpty()) { |
|
| 434 | + if (!$results->isEmpty()) { |
|
| 435 | 435 | if (call_user_func($callback, $results) === false) { |
| 436 | 436 | return false; |
| 437 | 437 | } |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | ->setKey(DynamoDb::marshalItem($this->model->getKeys())) |
| 465 | 465 | ->setConsistentRead(true); |
| 466 | 466 | |
| 467 | - if (! empty($columns)) { |
|
| 467 | + if (!empty($columns)) { |
|
| 468 | 468 | $query |
| 469 | 469 | ->setProjectionExpression($this->projectionExpression->parse($columns)) |
| 470 | 470 | ->setExpressionAttributeNames($this->expressionAttributeNames->all()); |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | |
| 505 | 505 | $table = $this->model->getTable(); |
| 506 | 506 | |
| 507 | - $keys = collect($ids)->map(function ($id) { |
|
| 508 | - if (! is_array($id)) { |
|
| 507 | + $keys = collect($ids)->map(function($id) { |
|
| 508 | + if (!is_array($id)) { |
|
| 509 | 509 | $id = [$this->model->getKeyName() => $id]; |
| 510 | 510 | } |
| 511 | 511 | |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | if (count($result) == count(array_unique($id))) { |
| 543 | 543 | return $result; |
| 544 | 544 | } |
| 545 | - } elseif (! is_null($result)) { |
|
| 545 | + } elseif (!is_null($result)) { |
|
| 546 | 546 | return $result; |
| 547 | 547 | } |
| 548 | 548 | |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | public function firstOrFail($columns = []) |
| 563 | 563 | { |
| 564 | - if (! is_null($model = $this->first($columns))) { |
|
| 564 | + if (!is_null($model = $this->first($columns))) { |
|
| 565 | 565 | return $model; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -577,12 +577,12 @@ discard block |
||
| 577 | 577 | */ |
| 578 | 578 | public function removeAttribute(...$attributes) |
| 579 | 579 | { |
| 580 | - $keySet = ! empty(array_filter($this->model->getKeys())); |
|
| 580 | + $keySet = !empty(array_filter($this->model->getKeys())); |
|
| 581 | 581 | |
| 582 | - if (! $keySet) { |
|
| 582 | + if (!$keySet) { |
|
| 583 | 583 | $analyzer = $this->getConditionAnalyzer(); |
| 584 | 584 | |
| 585 | - if (! $analyzer->isExactSearch()) { |
|
| 585 | + if (!$analyzer->isExactSearch()) { |
|
| 586 | 586 | throw new InvalidQuery('Need to provide the key in your query'); |
| 587 | 587 | } |
| 588 | 588 | |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | { |
| 663 | 663 | $limit = isset($this->limit) ? $this->limit : static::MAX_LIMIT; |
| 664 | 664 | |
| 665 | - return $this->getAll($columns, $limit, ! isset($this->limit)); |
|
| 665 | + return $this->getAll($columns, $limit, !isset($this->limit)); |
|
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | public function count() |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | $op = 'Scan'; |
| 749 | 749 | $queryBuilder = DynamoDb::table($this->model->getTable()); |
| 750 | 750 | |
| 751 | - if (! empty($this->wheres)) { |
|
| 751 | + if (!empty($this->wheres)) { |
|
| 752 | 752 | $analyzer = $this->getConditionAnalyzer(); |
| 753 | 753 | |
| 754 | 754 | if ($keyConditions = $analyzer->keyConditions()) { |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $queryBuilder->setLimit($limit); |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | - if (! empty($columns)) { |
|
| 777 | + if (!empty($columns)) { |
|
| 778 | 778 | // Either we try to get the count or specific columns |
| 779 | 779 | if ($columns == ['count(*)']) { |
| 780 | 780 | $queryBuilder->setSelect('COUNT'); |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | } |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | - if (! empty($this->lastEvaluatedKey)) { |
|
| 786 | + if (!empty($this->lastEvaluatedKey)) { |
|
| 787 | 787 | $queryBuilder->setExclusiveStartKey($this->lastEvaluatedKey); |
| 788 | 788 | } |
| 789 | 789 | |
@@ -816,8 +816,8 @@ discard block |
||
| 816 | 816 | $keys = collect($this->model->getKeyNames()); |
| 817 | 817 | |
| 818 | 818 | // could be ['id' => 'foo'], ['id1' => 'foo', 'id2' => 'bar'] |
| 819 | - $single = $keys->first(function ($name) use ($id) { |
|
| 820 | - return ! isset($id[$name]); |
|
| 819 | + $single = $keys->first(function($name) use ($id) { |
|
| 820 | + return !isset($id[$name]); |
|
| 821 | 821 | }) === null; |
| 822 | 822 | |
| 823 | 823 | if ($single) { |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | */ |
| 871 | 871 | public function withoutGlobalScope($scope) |
| 872 | 872 | { |
| 873 | - if (! is_string($scope)) { |
|
| 873 | + if (!is_string($scope)) { |
|
| 874 | 874 | $scope = get_class($scope); |
| 875 | 875 | } |
| 876 | 876 | |
@@ -917,18 +917,18 @@ discard block |
||
| 917 | 917 | */ |
| 918 | 918 | public function applyScopes() |
| 919 | 919 | { |
| 920 | - if (! $this->scopes) { |
|
| 920 | + if (!$this->scopes) { |
|
| 921 | 921 | return $this; |
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | $builder = $this; |
| 925 | 925 | |
| 926 | 926 | foreach ($builder->scopes as $identifier => $scope) { |
| 927 | - if (! isset($builder->scopes[$identifier])) { |
|
| 927 | + if (!isset($builder->scopes[$identifier])) { |
|
| 928 | 928 | continue; |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | - $builder->callScope(function (self $builder) use ($scope) { |
|
| 931 | + $builder->callScope(function(self $builder) use ($scope) { |
|
| 932 | 932 | // If the scope is a Closure we will just go ahead and call the scope with the |
| 933 | 933 | // builder instance. The "callScope" method will properly group the clauses |
| 934 | 934 | // that are added to this query so "where" clauses maintain proper logic. |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | */ |
| 988 | 988 | public function __call($method, $parameters) |
| 989 | 989 | { |
| 990 | - if (method_exists($this->model, $scope = 'scope'.ucfirst($method))) { |
|
| 990 | + if (method_exists($this->model, $scope = 'scope' . ucfirst($method))) { |
|
| 991 | 991 | return $this->callScope([$this->model, $scope], $parameters); |
| 992 | 992 | } |
| 993 | 993 | |
@@ -25,6 +25,6 @@ |
||
| 25 | 25 | $this->names->set($attribute); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - return 'REMOVE '.implode(', ', $this->names->placeholders()); |
|
| 28 | + return 'REMOVE ' . implode(', ', $this->names->placeholders()); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | $prefix = ''; |
| 79 | 79 | |
| 80 | 80 | if (count($parsed) > 0) { |
| 81 | - $prefix = strtoupper($boolean).' '; |
|
| 81 | + $prefix = strtoupper($boolean) . ' '; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if ($type === 'Nested') { |
| 85 | - $parsed[] = $prefix.$this->parseNestedCondition($value); |
|
| 85 | + $parsed[] = $prefix . $this->parseNestedCondition($value); |
|
| 86 | 86 | continue; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - $parsed[] = $prefix.$this->parseCondition( |
|
| 89 | + $parsed[] = $prefix . $this->parseCondition( |
|
| 90 | 90 | Arr::get($condition, 'column'), |
| 91 | 91 | $type, |
| 92 | 92 | $value |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | protected function parseNestedCondition(array $conditions) |
| 112 | 112 | { |
| 113 | - return '('.$this->parse($conditions).')'; |
|
| 113 | + return '(' . $this->parse($conditions) . ')'; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | protected function parseCondition($name, $operator, $value) |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | foreach ($value as $item) { |
| 165 | 165 | $placeholder = $this->placeholder->next(); |
| 166 | 166 | |
| 167 | - $valuePlaceholders[] = ':'.$placeholder; |
|
| 167 | + $valuePlaceholders[] = ':' . $placeholder; |
|
| 168 | 168 | |
| 169 | 169 | $this->values->set($placeholder, DynamoDb::marshalValue($item)); |
| 170 | 170 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | public function save(array $options = []) |
| 124 | 124 | { |
| 125 | - $create = ! $this->exists; |
|
| 125 | + $create = !$this->exists; |
|
| 126 | 126 | |
| 127 | 127 | if ($this->fireModelEvent('saving') === false) { |
| 128 | 128 | return false; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if (! $create && $this->fireModelEvent('updating') === false) { |
|
| 135 | + if (!$create && $this->fireModelEvent('updating') === false) { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | $saved = $this->newQuery()->save(); |
| 144 | 144 | |
| 145 | - if (! $saved) { |
|
| 145 | + if (!$saved) { |
|
| 146 | 146 | return $saved; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function saveAsync(array $options = []) |
| 164 | 164 | { |
| 165 | - $create = ! $this->exists; |
|
| 165 | + $create = !$this->exists; |
|
| 166 | 166 | |
| 167 | 167 | if ($this->fireModelEvent('saving') === false) { |
| 168 | 168 | return false; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | return false; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if (! $create && $this->fireModelEvent('updating') === false) { |
|
| 175 | + if (!$create && $this->fireModelEvent('updating') === false) { |
|
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $savePromise = $this->newQuery()->saveAsync(); |
| 184 | 184 | |
| 185 | - $savePromise->then(function ($result) use ($create, $options) { |
|
| 185 | + $savePromise->then(function($result) use ($create, $options) { |
|
| 186 | 186 | if (Arr::get($result, '@metadata.statusCode') === 200) { |
| 187 | 187 | $this->exists = true; |
| 188 | 188 | $this->wasRecentlyCreated = $create; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $deletePromise = $this->newQuery()->deleteAsync(); |
| 254 | 254 | |
| 255 | - $deletePromise->then(function () { |
|
| 255 | + $deletePromise->then(function() { |
|
| 256 | 256 | $this->fireModelEvent('deleted', false); |
| 257 | 257 | }); |
| 258 | 258 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | public function refresh() |
| 271 | 271 | { |
| 272 | - if (! $this->exists) { |
|
| 272 | + if (!$this->exists) { |
|
| 273 | 273 | return $this; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | public function hasCompositeKey() |
| 300 | 300 | { |
| 301 | - return ! empty($this->compositeKey); |
|
| 301 | + return !empty($this->compositeKey); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | public function setId($id) |
| 335 | 335 | { |
| 336 | - if (! is_array($id)) { |
|
| 336 | + if (!is_array($id)) { |
|
| 337 | 337 | $this->setAttribute($this->getKeyName(), $id); |
| 338 | 338 | |
| 339 | 339 | return $this; |
@@ -35,8 +35,8 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function finalize() |
| 37 | 37 | { |
| 38 | - $this->query = array_filter($this->query, function ($value) { |
|
| 39 | - return ! empty($value) || is_bool($value) || is_numeric($value); |
|
| 38 | + $this->query = array_filter($this->query, function($value) { |
|
| 39 | + return !empty($value) || is_bool($value) || is_numeric($value); |
|
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | 42 | return $this; |