MissingNodeException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 3
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace AmaTeam\TreeAccess\API\Exception;
4
5
use AmaTeam\TreeAccess\Paths;
6
use Throwable;
7
8
class MissingNodeException extends IllegalTargetException
9
{
10
    /**
11
     * @param string[] $path
12
     * @param string|null $message
13
     * @param Throwable|null $previous
14
     */
15 3
    public function __construct(array $path, $message = null, Throwable $previous = null)
16
    {
17 3
        if ($message === null) {
18 1
            $template = 'Node at requested path `%s` doesn\'t exist';
19 1
            $message = sprintf($template, Paths::toString($path));
20
        }
21 3
        parent::__construct($path, $message, $previous);
22 3
    }
23
}
24