Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
TranslatablePageStatus | |
0.00% |
0 / 5 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
isEqual | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | declare( strict_types = 1 ); |
3 | |
4 | namespace MediaWiki\Extension\Translate\PageTranslation; |
5 | |
6 | use InvalidArgumentException; |
7 | use MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundleStatus; |
8 | |
9 | /** |
10 | * Stores and validates possible statuses for TranslatablePage |
11 | * @author Abijeet Patro |
12 | * @since 2022.09 |
13 | * @license GPL-2.0-or-later |
14 | */ |
15 | class TranslatablePageStatus implements TranslatableBundleStatus { |
16 | public const PROPOSED = 1; |
17 | public const ACTIVE = 2; |
18 | public const OUTDATED = 3; |
19 | public const BROKEN = 4; |
20 | |
21 | private $status; |
22 | |
23 | public function __construct( int $status ) { |
24 | if ( !in_array( $status, [ self::PROPOSED, self::ACTIVE, self::OUTDATED, self::BROKEN ] ) ) { |
25 | throw new InvalidArgumentException( "Invalid status: $status" ); |
26 | } |
27 | $this->status = $status; |
28 | } |
29 | |
30 | public function isEqual( int $status ): bool { |
31 | return $this->status === $status; |
32 | } |
33 | |
34 | public function getId(): int { |
35 | return $this->status; |
36 | } |
37 | } |