blob: 65f9508b99a72ffe3070fdaf0d8b30f3ceb65520 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\PageTranslation;
use InvalidArgumentException;
use MediaWiki\Extension\Translate\Validation\ValidationIssue;
use MessageSpecifier;
/**
* @author Niklas Laxström
* @license GPL-2.0-or-later
* @since 2021.05
* @see ValidationIssue (similar, but different use case)
*/
class TranslationUnitIssue implements MessageSpecifier {
public const ERROR = 'error';
public const WARNING = 'warning';
/** @var string self::ERROR|self::WARNING */
private $severity;
/** @var string */
private $messageKey;
/** @var array */
private $messageParams;
public function __construct( string $severity, string $messageKey, array $messageParams = [] ) {
if ( !in_array( $severity, [ self::ERROR, self::WARNING ] ) ) {
throw new InvalidArgumentException( 'Invalid value for severity: ' . $severity );
}
$this->severity = $severity;
$this->messageKey = $messageKey;
$this->messageParams = $messageParams;
}
public function getSeverity(): string {
return $this->severity;
}
public function getKey(): string {
return $this->messageKey;
}
public function getParams(): array {
return $this->messageParams;
}
}
|