| Total Complexity | 5 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | final class ErrorMessage |
||
| 8 | { |
||
| 9 | private string $message = ''; |
||
| 10 | private array $parameters = []; |
||
| 11 | private ErrorMessageFormatterInterface $formatter; |
||
| 12 | |||
| 13 | 173 | public function __construct(string $message, array $parameters = [], ?ErrorMessageFormatterInterface $formatter = null) |
|
| 14 | { |
||
| 15 | 173 | $this->message = $message; |
|
| 16 | 173 | $this->parameters = $parameters; |
|
| 17 | 173 | $this->formatter = $formatter ?? new ErrorMessageFormatter(); |
|
| 18 | 173 | } |
|
| 19 | |||
| 20 | 67 | public function getMessage(): string |
|
| 21 | { |
||
| 22 | 67 | return $this->message; |
|
| 23 | } |
||
| 24 | |||
| 25 | 67 | public function getParameters(): array |
|
| 28 | } |
||
| 29 | |||
| 30 | 67 | public function getFormattedMessage(): string |
|
| 31 | { |
||
| 32 | 67 | return $this->formatter->format($this); |
|
| 33 | } |
||
| 34 | |||
| 35 | 66 | public function __toString(): string |
|
| 38 | } |
||
| 39 | } |
||
| 40 |