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

ExistingSelectOnePathResult::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 4
rs 10
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