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