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 $severity;
22 private $messageKey;
24 private $messageParams;
25
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 );
29 }
30 $this->severity = $severity;
31 $this->messageKey = $messageKey;
32 $this->messageParams = $messageParams;
33 }
34
35 public function getSeverity(): string {
36 return $this->severity;
37 }
38
39 public function getKey(): string {
40 return $this->messageKey;
41 }
42
43 public function getParams(): array {
44 return $this->messageParams;
45 }
46}