@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function setOrderByParameters($orderBy): void |
| 45 | 45 | { |
| 46 | - [$column, $direction] = explode(',', $orderBy); |
|
| 46 | + [ $column, $direction ] = explode(',', $orderBy); |
|
| 47 | 47 | |
| 48 | 48 | $this->column = $column; |
| 49 | 49 | $this->direction = $direction ?? 'asc'; |
| 50 | 50 | |
| 51 | - if (! \in_array($this->direction, ['asc', 'desc'])) { |
|
| 51 | + if (!\in_array($this->direction, [ 'asc', 'desc' ])) { |
|
| 52 | 52 | $this->direction = 'asc'; |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | return $model; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (! preg_match($this->allowedToContain, $this->column)) { |
|
| 70 | + if (!preg_match($this->allowedToContain, $this->column)) { |
|
| 71 | 71 | throw new ValidationException('OrderBy query parameter contains illegal characters.'); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | protected function parseOperator($filterValue): string |
| 153 | 153 | { |
| 154 | - if (! \is_array($filterValue)) { |
|
| 154 | + if (!\is_array($filterValue)) { |
|
| 155 | 155 | return config('repositories.filtering.default_operator', '$eq'); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $parsedDataType = substr($value, 0, $lastColonPosition); |
| 176 | 176 | |
| 177 | - if (! $this->isValidDataType($parsedDataType)) { |
|
| 177 | + if (!$this->isValidDataType($parsedDataType)) { |
|
| 178 | 178 | return config('repositories.filtering.default_data_type', '$string'); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | private function extractValue($filterValue): string |
| 211 | 211 | { |
| 212 | - if (! \is_array($filterValue)) { |
|
| 212 | + if (!\is_array($filterValue)) { |
|
| 213 | 213 | return $filterValue; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | private function isValidDataType($dataType, $strict = false): bool |
| 228 | 228 | { |
| 229 | - if (! in_array($dataType, config('repositories.filtering.allowed_data_types', '$string'), true)) { |
|
| 229 | + if (!in_array($dataType, config('repositories.filtering.allowed_data_types', '$string'), true)) { |
|
| 230 | 230 | if ($strict) { |
| 231 | 231 | throw new RepositoryException('Invalid/Unallowed data type passed.'); |
| 232 | 232 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function apply($model, RepositoryInterface $repository): Builder |
| 46 | 46 | { |
| 47 | - if (! empty($this->attributes) && \is_array($this->attributes)) { |
|
| 47 | + if (!empty($this->attributes) && \is_array($this->attributes)) { |
|
| 48 | 48 | foreach ($this->attributes as $parameter => $value) { |
| 49 | 49 | $model = $this->applyFilter($model, $parameter, $value); |
| 50 | 50 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $parser = (new FilterQueryParser($parameter, $value))->parse(); |
| 68 | 68 | $relation = $parser->getRelation(); |
| 69 | 69 | |
| 70 | - if ($relation && ! $this->modelHasRelation($model->getModel(), $relation)) { |
|
| 70 | + if ($relation && !$this->modelHasRelation($model->getModel(), $relation)) { |
|
| 71 | 71 | throw new RepositoryException('Trying to filter by non existent relation.'); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $valueToSearch = $parser->getValue(); |
| 77 | 77 | |
| 78 | 78 | if ($relation) { |
| 79 | - $model = $model->whereHas($relation, function ($query) use ($column, $dataType, $valueToSearch): void { |
|
| 79 | + $model = $model->whereHas($relation, function($query) use ($column, $dataType, $valueToSearch): void { |
|
| 80 | 80 | $this->applyDataTypeFilter($query, $column, $dataType, $valueToSearch); |
| 81 | 81 | }); |
| 82 | 82 | } else { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $namespace = 'Noitran\Repositories\Criteria\Support\\'; |
| 115 | 115 | $criteria = $namespace . ucfirst($dataType) . 'Criteria'; |
| 116 | 116 | |
| 117 | - if (! class_exists($criteria)) { |
|
| 117 | + if (!class_exists($criteria)) { |
|
| 118 | 118 | $defaultCriteria = $namespace . 'DefaultCriteria'; |
| 119 | 119 | |
| 120 | 120 | return new $defaultCriteria(); |