Passed
Push — master ( 162b02...da0f52 )
by Edward
02:27
created

SelectPathsResult::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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
    public function __construct(PathEncoderInterface $encoder, PathInterface ...$paths)
18
    {
19
        $this->encoder = $encoder;
20
        $this->paths = $paths;
21
    }
22
23
    public function get(): array
24
    {
25
        return $this->paths;
26
    }
27
28
    public function encode(): array
29
    {
30
        return array_map([$this->encoder, 'encodePath'], $this->paths);
31
    }
32
}
33