OuterIndexNotFoundException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getInnerIndex() 0 3 1
A getIndexMap() 0 3 1
A buildMessage() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Remorhaz\JSON\Path\Value\Exception;
6
7
use OutOfRangeException;
8
use Remorhaz\JSON\Path\Value\IndexMapInterface;
9
use Throwable;
10
11
final class OuterIndexNotFoundException extends OutOfRangeException implements ExceptionInterface
12
{
13
14
    private $innerIndex;
15
16
    private $indexMap;
17
18 6
    public function __construct(int $innerIndex, IndexMapInterface $indexMap, Throwable $previous = null)
19
    {
20 6
        $this->innerIndex = $innerIndex;
21 6
        $this->indexMap = $indexMap;
22 6
        parent::__construct($this->buildMessage(), 0, $previous);
23 6
    }
24
25 6
    private function buildMessage(): string
26
    {
27 6
        return "Outer index not found in index map for inner index {$this->innerIndex}";
28
    }
29
30 1
    public function getInnerIndex(): int
31
    {
32 1
        return $this->innerIndex;
33
    }
34
35 1
    public function getIndexMap(): IndexMapInterface
36
    {
37 1
        return $this->indexMap;
38
    }
39
}
40