17 public const ERROR =
'error';
18 public const WARNING =
'warning';
20 private string $severity;
21 private string $messageKey;
22 private array $messageParams;
24 public function __construct(
string $severity,
string $messageKey, array $messageParams = [] ) {
25 if ( !in_array( $severity, [ self::ERROR, self::WARNING ] ) ) {
26 throw new InvalidArgumentException(
'Invalid value for severity: ' . $severity );
28 $this->severity = $severity;
29 $this->messageKey = $messageKey;
30 $this->messageParams = $messageParams;
33 public function getSeverity():
string {
34 return $this->severity;
37 public function getKey():
string {
38 return $this->messageKey;
41 public function getParams(): array {
42 return $this->messageParams;