@@ -5,7 +5,7 @@ |
||
| 5 | 5 | namespace { |
| 6 | 6 | use Noitran\RQL\Services\RQLService; |
| 7 | 7 | |
| 8 | - if (! function_exists('rql')) { |
|
| 8 | + if (!function_exists('rql')) { |
|
| 9 | 9 | /** |
| 10 | 10 | * Get default RQL service. |
| 11 | 11 | * |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function enqueue($exprClass): self |
| 23 | 23 | { |
| 24 | - if (! $exprClass instanceof ExprInterface) { |
|
| 24 | + if (!$exprClass instanceof ExprInterface) { |
|
| 25 | 25 | throw new ExpressionException(sprintf( |
| 26 | 26 | 'The $exprClass variable is not an instance of %s.', |
| 27 | 27 | ExprInterface::class |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @var SpecInterface[] |
| 17 | 17 | */ |
| 18 | - protected $applicableSpecs = []; |
|
| 18 | + protected $applicableSpecs = [ ]; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * {@inheritdoc} |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function register(string $filterStrategy): self |
| 36 | 36 | { |
| 37 | - $this->applicableSpecs[] = new $filterStrategy(); |
|
| 37 | + $this->applicableSpecs[ ] = new $filterStrategy(); |
|
| 38 | 38 | |
| 39 | 39 | return $this; |
| 40 | 40 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function isSatisfiedBy(ProcessorInterface $processor, ExprInterface $exprClass): bool |
| 21 | 21 | { |
| 22 | - if (! \in_array($exprClass->getExpression(), ['$in', '$notIn', '$between'], true)) { |
|
| 22 | + if (!\in_array($exprClass->getExpression(), [ '$in', '$notIn', '$between' ], true)) { |
|
| 23 | 23 | return false; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function apply(ProcessorInterface $processor, ExprInterface $exprClass): Builder |
| 33 | 33 | { |
| 34 | 34 | /** @var EloquentProcessor $processor */ |
| 35 | - $method = $processor::getMethodMap()[$exprClass->getExpression()]; |
|
| 35 | + $method = $processor::getMethodMap()[ $exprClass->getExpression() ]; |
|
| 36 | 36 | |
| 37 | 37 | return $processor->getBuilder()->{$method}( |
| 38 | 38 | $exprClass->getColumn(), |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function isSatisfiedBy(ProcessorInterface $processor, ExprInterface $exprClass): bool |
| 22 | 22 | { |
| 23 | - if (! $exprClass instanceof OrExpr) { |
|
| 23 | + if (!$exprClass instanceof OrExpr) { |
|
| 24 | 24 | return false; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | public function apply(ProcessorInterface $processor, ExprInterface $exprClass): Builder |
| 34 | 34 | { |
| 35 | 35 | /* @var EloquentProcessor $processor */ |
| 36 | - return $processor->getBuilder()->where(function (Builder $builder) use ($exprClass) { |
|
| 36 | + return $processor->getBuilder()->where(function(Builder $builder) use ($exprClass) { |
|
| 37 | 37 | $values = $exprClass->getValue(); |
| 38 | 38 | |
| 39 | 39 | foreach ($values as $value) { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function isSatisfiedBy(ProcessorInterface $processor, ExprInterface $exprClass): bool |
| 21 | 21 | { |
| 22 | 22 | /** @var EloquentProcessor $processor */ |
| 23 | - if (! \in_array($exprClass->getExpression(), $processor::getComparisonMethods(), false)) { |
|
| 23 | + if (!\in_array($exprClass->getExpression(), $processor::getComparisonMethods(), false)) { |
|
| 24 | 24 | return false; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | public function apply(ProcessorInterface $processor, ExprInterface $exprClass): Builder |
| 34 | 34 | { |
| 35 | 35 | /** @var EloquentProcessor $processor */ |
| 36 | - $method = $processor::getMethodMap()[$exprClass->getExpression()]; |
|
| 36 | + $method = $processor::getMethodMap()[ $exprClass->getExpression() ]; |
|
| 37 | 37 | |
| 38 | 38 | return $processor->getBuilder()->{$method}( |
| 39 | 39 | $exprClass->getColumn(), |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $publishPath = base_path('config/rql.php'); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $this->publishes([$configPath => $publishPath], 'config'); |
|
| 48 | + $this->publishes([ $configPath => $publishPath ], 'config'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | protected function registerConfig(): void |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | protected function bindProcessor(): void |
| 70 | 70 | { |
| 71 | - $this->app->bind(ProcessorInterface::class, function () { |
|
| 71 | + $this->app->bind(ProcessorInterface::class, function() { |
|
| 72 | 72 | return rql()->getProcessor(); |
| 73 | 73 | }); |
| 74 | 74 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | protected function parseExpression($filterValue): string |
| 130 | 130 | { |
| 131 | - if (! \is_array($filterValue)) { |
|
| 131 | + if (!\is_array($filterValue)) { |
|
| 132 | 132 | return config('repositories.filtering.default_expression', '$eq'); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $parsedDataType = substr($value, 0, $lastColonPosition); |
| 153 | 153 | |
| 154 | - if (! $this->isValidDataType($parsedDataType)) { |
|
| 154 | + if (!$this->isValidDataType($parsedDataType)) { |
|
| 155 | 155 | return config('repositories.filtering.default_data_type', '$string'); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | $value = $this->extractValue($filterValue); |
| 172 | 172 | |
| 173 | - if (Str::startsWith($value, ['$']) && false !== strpos($value, ':')) { |
|
| 173 | + if (Str::startsWith($value, [ '$' ]) && false !== strpos($value, ':')) { |
|
| 174 | 174 | $lastColonPosition = strpos($value, ':'); |
| 175 | 175 | |
| 176 | 176 | return substr($value, $lastColonPosition + 1); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | private function extractValue($filterValue): string |
| 188 | 188 | { |
| 189 | - if (! \is_array($filterValue)) { |
|
| 189 | + if (!\is_array($filterValue)) { |
|
| 190 | 190 | return $filterValue; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | private function isValidDataType($dataType, $strict = false): bool |
| 205 | 205 | { |
| 206 | - if (! \in_array($dataType, config('repositories.filtering.allowed_data_types', '$string'), true)) { |
|
| 206 | + if (!\in_array($dataType, config('repositories.filtering.allowed_data_types', '$string'), true)) { |
|
| 207 | 207 | if ($strict) { |
| 208 | 208 | throw new RuntimeException('Invalid/Unallowed data type passed.'); |
| 209 | 209 | } |