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

SelectPathsResult   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

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 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