Passed
Push — master ( c6e62a...162b02 )
by Edward
03:02
created

ExistingSelectOnePathResult   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 23
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 3 1
A encode() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Processor;
5
6
use Remorhaz\JSON\Data\Path\PathInterface;
7
8
final class ExistingSelectOnePathResult implements SelectOnePathResultInterface
9
{
10
11
    private $path;
12
13
    private $encoder;
14
15
    public function __construct(PathEncoder $encoder, PathInterface $path)
16
    {
17
        $this->encoder = $encoder;
18
        $this->path = $path;
19
    }
20
21
    public function get(): PathInterface
22
    {
23
        return $this->path;
24
    }
25
26
    public function encode(): string
27
    {
28
        return $this
29
            ->encoder
30
            ->encodePath($this->path);
31
    }
32
}
33