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

SelectPathsResult   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A encode() 0 3 1
A __construct() 0 4 1
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