| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function __construct(array $query) |
||
| 25 | { |
||
| 26 | /** @var ExpressionInterface $expr */ |
||
| 27 | foreach ($query as $key => $expr) { |
||
| 28 | if (!$expr instanceof ExpressionInterface) { |
||
| 29 | throw new RuntimeException( |
||
| 30 | "Query operator must implement ExpressionInterface, found: ".gettype($expr) |
||
| 31 | ); |
||
| 32 | } |
||
| 33 | |||
| 34 | $this->exprs[] = function (array $doc) use ($key, $expr) { |
||
| 35 | return isset($doc[$key]) && $expr->evaluate($doc[$key]); |
||
| 36 | }; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 56 |