QueryFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 24
ccs 10
cts 10
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createQuery() 0 3 1
A create() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Remorhaz\JSON\Path\Query;
6
7
use Remorhaz\JSON\Path\Parser\Ll1ParserFactory;
8
use Remorhaz\JSON\Path\Parser\Parser;
9
use Remorhaz\JSON\Path\Parser\ParserInterface;
10
11
final class QueryFactory implements QueryFactoryInterface
12
{
13
14
    private $parser;
15
16
    private $astTranslator;
17
18 1
    public static function create(): QueryFactoryInterface
19
    {
20 1
        return new QueryFactory(
21 1
            new Parser(new Ll1ParserFactory()),
22 1
            new AstTranslator(),
23
        );
24
    }
25
26 5
    public function __construct(ParserInterface $parser, AstTranslatorInterface $astTranslator)
27
    {
28 5
        $this->parser = $parser;
29 5
        $this->astTranslator = $astTranslator;
30 5
    }
31
32 4
    public function createQuery(string $path): QueryInterface
33
    {
34 4
        return new LazyQuery($path, $this->parser, $this->astTranslator, new CallbackBuilder());
35
    }
36
}
37