Passed
Push — master ( 8e4f12...3d58fd )
by Edward
05:59
created

SelectPathsResult::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Processor\Result;
5
6
use function array_map;
7
use Remorhaz\JSON\Data\Path\PathInterface;
8
use Remorhaz\JSON\Path\Processor\PathEncoderInterface;
9
10
final class SelectPathsResult implements SelectPathsResultInterface
11
{
12
13
    private $paths;
14
15
    private $encoder;
16
17 5
    public function __construct(PathEncoderInterface $encoder, PathInterface ...$paths)
18
    {
19 5
        $this->encoder = $encoder;
20 5
        $this->paths = $paths;
21 5
    }
22
23 2
    public function get(): array
24
    {
25 2
        return $this->paths;
26
    }
27
28 3
    public function encode(): array
29
    {
30 3
        return array_map([$this->encoder, 'encodePath'], $this->paths);
31
    }
32
}
33