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

ValueNotFoundException::getValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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 ValueNotFoundException 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 "Value 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