Completed
Push — master ( 113bfa...89e2e4 )
by Edward
07:06
created

LiteralArrayValueList   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 30
ccs 12
cts 12
cp 1
rs 10
c 1
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getValues() 0 3 1
A getIndexMap() 0 3 1
A getValue() 0 7 2
A __construct() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Value;
5
6
use Remorhaz\JSON\Data\Value\ArrayValueInterface;
7
use Remorhaz\JSON\Data\Value\ValueInterface;
8
9
final class LiteralArrayValueList implements ValueListInterface
10
{
11
12
    private $indexMap;
13
14
    private $values;
15
16 5
    public function __construct(IndexMapInterface $indexMap, ArrayValueInterface ...$values)
17
    {
18 5
        $this->indexMap = $indexMap;
19 5
        $this->values = $values;
20 5
    }
21
22 1
    public function getIndexMap(): IndexMapInterface
23
    {
24 1
        return $this->indexMap;
25
    }
26
27 2
    public function getValues(): array
28
    {
29 2
        return $this->values;
30
    }
31
32 2
    public function getValue(int $index): ValueInterface
33
    {
34 2
        if (!isset($this->values[$index])) {
35 1
            throw new Exception\ValueNotFoundException($index, $this);
36
        }
37
38 1
        return $this->values[$index];
39
    }
40
}
41