@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function getProcessor(): ProcessorInterface |
| 40 | 40 | { |
| 41 | - if (! $this->processor) { |
|
| 41 | + if (!$this->processor) { |
|
| 42 | 42 | $this->processor = $this->createProcessor(); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $name = $this->config->get('rql.default_processor', 'eloquent'); |
| 54 | 54 | $class = config("rql.processors.{$name}.class"); |
| 55 | 55 | |
| 56 | - if (! class_exists($class)) { |
|
| 56 | + if (!class_exists($class)) { |
|
| 57 | 57 | throw new RuntimeException('Processor class "' . $class . '" does not exist!'); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | protected function createFilterSpecResolver(array $config): ResolverInterface |
| 71 | 71 | { |
| 72 | 72 | return (new FilterSpecResolver()) |
| 73 | - ->registerAll($config['filter_specs']); |
|
| 73 | + ->registerAll($config[ 'filter_specs' ]); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -86,6 +86,6 @@ discard block |
||
| 86 | 86 | throw new RuntimeException('RQL config does not exist.'); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - return $config['processors'][$processorName]; |
|
| 89 | + return $config[ 'processors' ][ $processorName ]; |
|
| 90 | 90 | } |
| 91 | 91 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function isSatisfiedBy(ProcessorInterface $processor, ExprInterface $exprClass): bool |
| 20 | 20 | { |
| 21 | - if (! $exprClass instanceof BetweenExpr) { |
|
| 21 | + if (!$exprClass instanceof BetweenExpr) { |
|
| 22 | 22 | return false; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -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 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | protected function parseExpression($filterValue): string |
| 147 | 147 | { |
| 148 | - if (! \is_array($filterValue)) { |
|
| 148 | + if (!\is_array($filterValue)) { |
|
| 149 | 149 | return config('rql.filtering.default_expression', '$eq'); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | $parsedDataType = substr($value, 0, $lastColonPosition); |
| 170 | 170 | |
| 171 | - if (! $this->isValidDataType($parsedDataType)) { |
|
| 171 | + if (!$this->isValidDataType($parsedDataType)) { |
|
| 172 | 172 | return config('rql.filtering.default_data_type', '$string'); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | { |
| 188 | 188 | $value = $this->extractValue($filterValue); |
| 189 | 189 | |
| 190 | - if (Str::startsWith($value, ['$']) && false !== strpos($value, ':')) { |
|
| 190 | + if (Str::startsWith($value, [ '$' ]) && false !== strpos($value, ':')) { |
|
| 191 | 191 | $lastColonPosition = strpos($value, ':'); |
| 192 | 192 | |
| 193 | 193 | return substr($value, $lastColonPosition + 1); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | private function extractValue($filterValue): string |
| 205 | 205 | { |
| 206 | - if (! \is_array($filterValue)) { |
|
| 206 | + if (!\is_array($filterValue)) { |
|
| 207 | 207 | return $filterValue; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | private function isValidDataType($dataType, $strict = false): bool |
| 222 | 222 | { |
| 223 | - if (! \in_array($dataType, config('rql.filtering.allowed_data_types', ['$string']), true)) { |
|
| 223 | + if (!\in_array($dataType, config('rql.filtering.allowed_data_types', [ '$string' ]), true)) { |
|
| 224 | 224 | if ($strict) { |
| 225 | 225 | throw new RuntimeException('Invalid/Not allowed data type passed.'); |
| 226 | 226 | } |