IllegalTargetException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 3 1
A __construct() 0 8 2
1
<?php
2
3
namespace AmaTeam\TreeAccess\API\Exception;
4
5
use AmaTeam\TreeAccess\Paths;
6
use Throwable;
7
8
class IllegalTargetException extends RuntimeException
9
{
10
    /**
11
     * @var string[]
12
     */
13
    private $path;
14
15
    /**
16
     * @param string[] $path
17
     * @param null $message
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $message is correct as it would always require null to be passed?
Loading history...
18
     * @param Throwable|null $previous
19
     */
20 8
    public function __construct(array $path, $message = null, Throwable $previous = null)
21
    {
22 8
        $this->path = $path;
23 8
        if (!$message) {
24 3
            $template = 'Can not access target at path `%s`';
25 3
            $message = sprintf($template, Paths::toString($path));
26
        }
27 8
        parent::__construct($message, $previous);
28 8
    }
29
30
    /**
31
     * @return string[]
32
     */
33
    public function getPath()
34
    {
35
        return $this->path;
36
    }
37
}
38