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

EvaluatedValueListBuilder::addResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
c 1
b 1
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Value;
5
6
final class EvaluatedValueListBuilder
7
{
8
9
    private $indexMap = [];
10
11
    private $results = [];
12
13 6
    public function addResult(bool $result, int $outerIndex): self
14
    {
15 6
        $this->indexMap[] = $outerIndex;
16 6
        $this->results[] = $result;
17
18 6
        return $this;
19
    }
20
21 7
    public function build(): EvaluatedValueListInterface
22
    {
23 7
        return new EvaluatedValueList(new IndexMap(...$this->indexMap), ...$this->results);
24
    }
25
}
26