noitran /
rql
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Noitran\RQL\Queues; |
||
| 6 | |||
| 7 | use Noitran\RQL\Contracts\Expression\ExprInterface; |
||
| 8 | use Noitran\RQL\Contracts\Queue\QueueInterface; |
||
| 9 | use Noitran\RQL\Exceptions\ExpressionException; |
||
| 10 | use Noitran\RQL\Expressions\AbstractExpr; |
||
| 11 | use SplQueue; |
||
| 12 | |||
| 13 | class ExprQueue extends SplQueue implements QueueInterface |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @param AbstractExpr $exprClass |
||
| 17 | * |
||
| 18 | * @throws ExpressionException |
||
| 19 | * |
||
| 20 | * @return ExprQueue |
||
| 21 | */ |
||
| 22 | 12 | public function enqueue($exprClass): self |
|
| 23 | { |
||
| 24 | 12 | if (! $exprClass instanceof ExprInterface) { |
|
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 25 | throw new ExpressionException(sprintf( |
||
| 26 | 'The $exprClass variable is not an instance of %s.', |
||
| 27 | ExprInterface::class |
||
| 28 | )); |
||
| 29 | } |
||
| 30 | |||
| 31 | 12 | parent::enqueue($exprClass); |
|
| 32 | |||
| 33 | 12 | return $this; |
|
| 34 | } |
||
| 35 | } |
||
| 36 |