noitran /
rql
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Noitran\RQL\Processors\Eloquent; |
||
| 6 | |||
| 7 | use Illuminate\Database\Eloquent\Builder; |
||
| 8 | use Noitran\RQL\Contracts\Expression\ExprInterface; |
||
| 9 | use Noitran\RQL\Contracts\Processor\ProcessorInterface; |
||
| 10 | use Noitran\RQL\Contracts\Processor\SpecInterface; |
||
| 11 | use Noitran\RQL\Expressions\BetweenExpr; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Class ApplyBetween. |
||
| 15 | */ |
||
| 16 | class ApplyBetween implements SpecInterface |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * {@inheritdoc} |
||
| 20 | */ |
||
| 21 | public function isSatisfiedBy(ProcessorInterface $processor, ExprInterface $exprClass): bool |
||
| 22 | { |
||
| 23 | if (! $exprClass instanceof BetweenExpr) { |
||
| 24 | return false; |
||
| 25 | } |
||
| 26 | |||
| 27 | return true; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * {@inheritdoc} |
||
| 32 | */ |
||
| 33 | public function apply(ProcessorInterface $processor, ExprInterface $exprClass): Builder |
||
| 34 | { |
||
| 35 | /* @var EloquentProcessor $processor */ |
||
| 36 | return $processor->getBuilder()->whereBetween( |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 37 | $exprClass->getColumn(), |
||
| 38 | $exprClass->getValue() |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |