Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
TranslatablePageStatus.php
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\PageTranslation;
5
6use InvalidArgumentException;
8
16 public const PROPOSED = 1;
17 public const ACTIVE = 2;
18 public const OUTDATED = 3;
19 public const BROKEN = 4;
20
21 private int $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}
Stores and validates possible statuses for TranslatablePage.