| Total Complexity | 6 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | final class LiteralValueList implements LiteralValueListInterface |
||
| 12 | { |
||
| 13 | |||
| 14 | private $indexMap; |
||
| 15 | |||
| 16 | private $value; |
||
| 17 | |||
| 18 | 5 | public function __construct(IndexMapInterface $indexMap, LiteralValueInterface $value) |
|
| 19 | { |
||
| 20 | 5 | $this->indexMap = $indexMap; |
|
| 21 | 5 | $this->value = $value; |
|
| 22 | 5 | } |
|
| 23 | |||
| 24 | 1 | public function getLiteral(): LiteralValueInterface |
|
| 27 | } |
||
| 28 | |||
| 29 | 2 | public function getValue(int $index): ValueInterface |
|
| 30 | { |
||
| 31 | 2 | $innerIndexes = $this->indexMap->getInnerIndexes(); |
|
| 32 | 2 | if (!isset($innerIndexes[$index])) { |
|
| 33 | 1 | throw new Exception\ValueNotFoundException($index, $this); |
|
| 34 | } |
||
| 35 | |||
| 36 | 1 | return $this->value; |
|
| 37 | } |
||
| 38 | |||
| 39 | 1 | public function getValues(): array |
|
| 40 | { |
||
| 41 | 1 | return array_fill_keys($this->indexMap->getInnerIndexes(), $this->value); |
|
| 42 | } |
||
| 43 | |||
| 44 | 1 | public function getIndexMap(): IndexMapInterface |
|
| 47 | } |
||
| 48 | } |
||
| 49 |