Total Complexity | 4 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
7 | abstract class PathException extends \OutOfBoundsException |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | protected string $key; |
||
13 | /** |
||
14 | * @var string[] |
||
15 | */ |
||
16 | protected array $path; |
||
17 | /** |
||
18 | * @var non-empty-string |
||
|
|||
19 | */ |
||
20 | protected string $pathDelimiter; |
||
21 | |||
22 | /** |
||
23 | * @param string $key |
||
24 | * @param string[] $path |
||
25 | * @param non-empty-string $pathDelimiter |
||
26 | */ |
||
27 | public function __construct(string $key, array $path, string $pathDelimiter) |
||
28 | { |
||
29 | parent::__construct(); |
||
30 | $this->key = $key; |
||
31 | $this->path = $path; |
||
32 | $this->pathDelimiter = $pathDelimiter; |
||
33 | parent::__construct("Key '{$this->key}' is not found in path '{$this->getPathString()}'"); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | */ |
||
39 | public function getKey(): string |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return string[] |
||
46 | */ |
||
47 | public function getPath(): array |
||
48 | { |
||
49 | return $this->path; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return string |
||
54 | */ |
||
55 | public function getPathString(): string |
||
58 | } |
||
59 | } |
||
60 |