SelectPathsResult::encode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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