Passed
Push — master ( c2f53d...1e149c )
by Edward
02:16
created

Query::isDefinite()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Query;
5
6
use function call_user_func;
7
use Remorhaz\JSON\Data\Value\NodeValueInterface;
8
use Remorhaz\JSON\Path\Value\ValueListInterface;
9
use Remorhaz\JSON\Path\Runtime\RuntimeInterface;
10
11
final class Query implements QueryInterface
12
{
13
14
    private $callback;
15
16
    private $isDefinite;
17
18
    public function __construct(callable $callback, bool $isDefinite)
19
    {
20
        $this->callback = $callback;
21
        $this->isDefinite = $isDefinite;
22
    }
23
24
    public function __invoke(RuntimeInterface $runtime, NodeValueInterface $rootNode): ValueListInterface
25
    {
26
        return call_user_func($this->callback, $runtime, $rootNode);
27
    }
28
29
    public function isDefinite(): bool
30
    {
31
        return $this->isDefinite;
32
    }
33
}
34