Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
TranslationUnitIssue.php
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\PageTranslation;
5
6use InvalidArgumentException;
8use MessageSpecifier;
9
16class TranslationUnitIssue implements MessageSpecifier {
17 public const ERROR = 'error';
18 public const WARNING = 'warning';
20 private string $severity;
21 private string $messageKey;
22 private array $messageParams;
23
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 );
27 }
28 $this->severity = $severity;
29 $this->messageKey = $messageKey;
30 $this->messageParams = $messageParams;
31 }
32
33 public function getSeverity(): string {
34 return $this->severity;
35 }
36
37 public function getKey(): string {
38 return $this->messageKey;
39 }
40
41 public function getParams(): array {
42 return $this->messageParams;
43 }
44}