| Total Complexity | 5 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | final class Query implements QueryInterface |
||
| 16 | { |
||
| 17 | |||
| 18 | private $source; |
||
| 19 | |||
| 20 | private $callbackBuilder; |
||
| 21 | |||
| 22 | 5 | public function __construct(string $source, CallbackBuilderInterface $callbackBuilder) |
|
| 26 | 5 | } |
|
| 27 | |||
| 28 | 3 | public function __invoke(NodeValueInterface $rootNode, RuntimeInterface $runtime): ValueListInterface |
|
| 29 | { |
||
| 30 | try { |
||
| 31 | $callback = $this |
||
| 32 | 3 | ->callbackBuilder |
|
| 33 | 3 | ->getCallback(); |
|
| 34 | |||
| 35 | $args = [ |
||
| 36 | 3 | (new NodeValueListBuilder()) |
|
| 37 | 3 | ->addValue($rootNode, 0) |
|
| 38 | 3 | ->build(), |
|
| 39 | 3 | $runtime->getValueListFetcher(), |
|
| 40 | 3 | $runtime->getEvaluator(), |
|
| 41 | 3 | $runtime->getLiteralFactory(), |
|
| 42 | 3 | $runtime->getMatcherFactory(), |
|
| 43 | ]; |
||
| 44 | |||
| 45 | 3 | return call_user_func($callback, ...$args); |
|
| 46 | 1 | } catch (Throwable $e) { |
|
| 47 | 1 | throw new Exception\QueryExecutionFailedException( |
|
| 48 | 1 | $this->source, |
|
| 49 | 1 | $this->callbackBuilder->getCallbackCode(), |
|
| 50 | $e, |
||
| 51 | ); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | 1 | public function getCapabilities(): CapabilitiesInterface |
|
| 56 | { |
||
| 57 | return $this |
||
| 58 | 1 | ->callbackBuilder |
|
| 59 | 1 | ->getCapabilities(); |
|
| 60 | } |
||
| 61 | |||
| 62 | 1 | public function getSource(): string |
|
| 65 | } |
||
| 66 | } |
||
| 67 |