Parser   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 12
c 2
b 0
f 1
dl 0
loc 22
ccs 11
cts 11
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A buildQueryAst() 0 12 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Remorhaz\JSON\Path\Parser;
6
7
use Remorhaz\UniLex\AST\Tree;
8
use Throwable;
9
10
final class Parser implements ParserInterface
11
{
12
13
    private $ll1ParserFactory;
14
15 3
    public function __construct(Ll1ParserFactoryInterface $ll1ParserFactory)
16
    {
17 3
        $this->ll1ParserFactory = $ll1ParserFactory;
18 3
    }
19
20 3
    public function buildQueryAst(string $path): Tree
21
    {
22
        try {
23 3
            $queryAst = new Tree();
24
            $this
25 3
                ->ll1ParserFactory
26 3
                ->createParser($path, $queryAst)
27 3
                ->run();
28
29 2
            return $queryAst;
30 1
        } catch (Throwable $e) {
31 1
            throw new Exception\QueryAstNotBuiltException($path, $e);
32
        }
33
    }
34
}
35