ama-team /
php-tree-access
| 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
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 |