17 public const ERROR =
'error';
18 public const WARNING =
'warning';
24 private $messageParams;
26 public function __construct(
string $severity,
string $messageKey, array $messageParams = [] ) {
27 if ( !in_array( $severity, [ self::ERROR, self::WARNING ] ) ) {
28 throw new InvalidArgumentException(
'Invalid value for severity: ' . $severity );
30 $this->severity = $severity;
31 $this->messageKey = $messageKey;
32 $this->messageParams = $messageParams;
35 public function getSeverity():
string {
36 return $this->severity;
39 public function getKey():
string {
40 return $this->messageKey;
43 public function getParams(): array {
44 return $this->messageParams;