Total Complexity | 10 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 69.57% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | final class ErrorMessage |
||
8 | { |
||
9 | private string $message = ''; |
||
10 | private array $parameters = []; |
||
11 | |||
12 | 173 | public function __construct(string $message, array $parameters = []) |
|
13 | { |
||
14 | 173 | $this->message = $message; |
|
15 | 173 | $this->parameters = $parameters; |
|
16 | 173 | } |
|
17 | |||
18 | public function getMessage(): string |
||
19 | { |
||
20 | return $this->message; |
||
21 | } |
||
22 | |||
23 | public function getParameters(): string |
||
24 | { |
||
25 | return $this->message; |
||
26 | } |
||
27 | |||
28 | 66 | public function getFormattedMessage(): string |
|
29 | { |
||
30 | 66 | return $this->format($this->message, $this->parameters); |
|
31 | } |
||
32 | |||
33 | 66 | public function __toString(): string |
|
34 | { |
||
35 | 66 | return $this->getFormattedMessage(); |
|
36 | } |
||
37 | |||
38 | 66 | private function format(string $message, array $params = []): string |
|
52 | } |
||
53 | } |
||
54 |