Total Complexity | 6 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | final class PropertyFileNotLoadedException extends RuntimeException implements ExceptionInterface |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | private $propertyName; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $propertyFile; |
||
22 | |||
23 | /** |
||
24 | * @var string|null |
||
25 | */ |
||
26 | private $errorMessage; |
||
27 | |||
28 | public function __construct( |
||
29 | string $propertyName, |
||
30 | string $propertyFile, |
||
31 | ?string $errorMessage, |
||
32 | Throwable $previous = null |
||
33 | ) { |
||
34 | $this->propertyName = $propertyName; |
||
35 | $this->propertyFile = $propertyFile; |
||
36 | $this->errorMessage = $errorMessage; |
||
37 | parent::__construct($this->buildMessage(), 0, $previous); |
||
38 | } |
||
39 | |||
40 | private function buildMessage(): string |
||
41 | { |
||
42 | $message = |
||
43 | "Failed to load range set for Unicode property '{$this->propertyName}' " . |
||
44 | "from file {$this->propertyFile}"; |
||
45 | |||
46 | return isset($this->errorMessage) |
||
47 | ? "{$message}:\n{$this->errorMessage}" |
||
48 | : $message; |
||
49 | } |
||
50 | |||
51 | public function getPropertyName(): string |
||
52 | { |
||
53 | return $this->propertyName; |
||
54 | } |
||
55 | |||
56 | public function getPropertyFile(): string |
||
57 | { |
||
58 | return $this->propertyFile; |
||
59 | } |
||
60 | |||
61 | public function getErrorMessage(): ?string |
||
64 | } |
||
65 | } |
||
66 |