Completed
Push — master ( 0c0824...37a545 )
by Edward
04:26
created

NodeValueListBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
dl 0
loc 18
ccs 0
cts 6
cp 0
rs 10
c 1
b 0
f 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addValue() 0 6 1
A build() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Value;
5
6
use Remorhaz\JSON\Data\Value\NodeValueInterface;
7
8
final class NodeValueListBuilder
9
{
10
11
    private $indexMap = [];
12
13
    private $values = [];
14
15
    public function addValue(NodeValueInterface $value, int $outerIndex): self
16
    {
17
        $this->indexMap[] = $outerIndex;
18
        $this->values[] = $value;
19
20
        return $this;
21
    }
22
23
    public function build(): NodeValueListInterface
24
    {
25
        return new NodeValueList(new IndexMap(...$this->indexMap), ...$this->values);
26
    }
27
}
28