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

SelectPathsResult   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A __construct() 0 4 1
A encode() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Processor;
5
6
use function array_map;
7
use Remorhaz\JSON\Data\Path\PathInterface;
8
9
final class SelectPathsResult implements SelectPathsResultInterface
10
{
11
12
    private $paths;
13
14
    private $encoder;
15
16
    public function __construct(PathEncoder $encoder, PathInterface ...$paths)
17
    {
18
        $this->encoder = $encoder;
19
        $this->paths = $paths;
20
    }
21
22
    public function get(): array
23
    {
24
        return $this->paths;
25
    }
26
27
    public function encode(): array
28
    {
29
        return array_map([$this->encoder, 'encodePath'], $this->paths);
30
    }
31
}
32