Passed
Push — master ( f6567e...6c178d )
by Edward
09:59 queued 07:10
created

NodeValueListBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
dl 0
loc 18
ccs 6
cts 6
cp 1
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 $outerIndexes = [];
12
13
    private $values = [];
14
15 5
    public function addValue(NodeValueInterface $value, int $outerIndex): self
16
    {
17 5
        $this->outerIndexes[] = $outerIndex;
18 5
        $this->values[] = $value;
19
20 5
        return $this;
21
    }
22
23 6
    public function build(): NodeValueListInterface
24
    {
25 6
        return new NodeValueList(new IndexMap(...$this->outerIndexes), ...$this->values);
26
    }
27
}
28