Passed
Push — master ( 67643d...113bfa )
by Edward
04:32
created

ResultNotFoundException   A

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 getValues() 0 3 1
A getIndex() 0 3 1
A buildMessage() 0 3 1
A __construct() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Value\Exception;
5
6
use OutOfRangeException;
7
use Remorhaz\JSON\Path\Value\ValueListInterface;
8
use Throwable;
9
10
final class ResultNotFoundException extends OutOfRangeException implements ExceptionInterface
11
{
12
13
    private $index;
14
15
    private $values;
16
17 6
    public function __construct(int $index, ValueListInterface $valueList, Throwable $previous = null)
18
    {
19 6
        $this->index = $index;
20 6
        $this->values = $valueList;
21 6
        parent::__construct($this->buildMessage(), 0, $previous);
22 6
    }
23
24 6
    private function buildMessage(): string
25
    {
26 6
        return "Result not found in list at position {$this->index}";
27
    }
28
29 1
    public function getIndex(): int
30
    {
31 1
        return $this->index;
32
    }
33
34 1
    public function getValues(): ValueListInterface
35
    {
36 1
        return $this->values;
37
    }
38
}
39