Total Complexity | 10 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | final class EvaluatedValueList implements EvaluatedValueListInterface |
||
9 | { |
||
10 | |||
11 | private $results; |
||
12 | |||
13 | private $indexMap; |
||
14 | |||
15 | private $values; |
||
16 | |||
17 | 14 | public function __construct(IndexMapInterface $indexMap, bool ...$results) |
|
18 | { |
||
19 | 14 | $this->indexMap = $indexMap; |
|
20 | 14 | $this->results = $results; |
|
21 | 14 | } |
|
22 | |||
23 | 4 | public function getValue(int $index): ValueInterface |
|
24 | { |
||
25 | 4 | $values = $this->getValues(); |
|
26 | 4 | if (!isset($values[$index])) { |
|
27 | 1 | throw new Exception\ValueNotFoundException($index, $this); |
|
28 | } |
||
29 | |||
30 | 3 | return $values[$index]; |
|
31 | } |
||
32 | |||
33 | 1 | public function getIndexMap(): IndexMapInterface |
|
34 | { |
||
35 | 1 | return $this->indexMap; |
|
36 | } |
||
37 | |||
38 | 4 | public function getResults(): array |
|
39 | { |
||
40 | 4 | return $this->results; |
|
41 | } |
||
42 | |||
43 | 3 | public function getResult(int $index): bool |
|
44 | { |
||
45 | 3 | if (!isset($this->results[$index])) { |
|
46 | 1 | throw new Exception\ResultNotFoundException($index, $this); |
|
47 | } |
||
48 | |||
49 | 2 | return $this->results[$index]; |
|
50 | } |
||
51 | |||
52 | 6 | public function getValues(): array |
|
59 | } |
||
60 | |||
61 | 4 | private function createResultValue(bool $result): EvaluatedValueInterface |
|
64 | } |
||
65 | } |
||
66 |