PointerReferenceNotFoundException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 4
crap 2
1
<?php declare(strict_types=1);
2
3
namespace DaveRandom\Jom\Exceptions;
4
5
use DaveRandom\Jom\Pointer;
6
7
final class PointerReferenceNotFoundException extends Exception
8
{
9 15
    public function __construct(string $message, Pointer $pointer, ?int $level = null, ?\Throwable $previous = null)
10
    {
11 15
        $message = \sprintf("%s while evaluating pointer '%s'", $message, (string)$pointer);
12
13 15
        if ($level !== null) {
14 3
            $message .= \sprintf(" at component '%s' (path component index %d)", $pointer->getPath()[$level], $level);
15
        }
16
17 15
        parent::__construct($message, 0, $previous);
18
    }
19
}
20