Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| ParserStatus | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getException | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getWarnings | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getCondsUsed | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isValid | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\AbuseFilter\Parser; |
| 4 | |
| 5 | use MediaWiki\Extension\AbuseFilter\Parser\Exception\ExceptionBase; |
| 6 | use MediaWiki\Extension\AbuseFilter\Parser\Exception\UserVisibleWarning; |
| 7 | |
| 8 | class ParserStatus { |
| 9 | /** |
| 10 | * @param ExceptionBase|null $excep An exception thrown while parsing, or null if it parsed correctly |
| 11 | * @param UserVisibleWarning[] $warnings |
| 12 | * @param int $condsUsed |
| 13 | */ |
| 14 | public function __construct( |
| 15 | protected readonly ?ExceptionBase $excep, |
| 16 | protected readonly array $warnings, |
| 17 | protected readonly int $condsUsed |
| 18 | ) { |
| 19 | } |
| 20 | |
| 21 | public function getException(): ?ExceptionBase { |
| 22 | return $this->excep; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * @return UserVisibleWarning[] |
| 27 | */ |
| 28 | public function getWarnings(): array { |
| 29 | return $this->warnings; |
| 30 | } |
| 31 | |
| 32 | public function getCondsUsed(): int { |
| 33 | return $this->condsUsed; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Whether the parsing/evaluation happened successfully. |
| 38 | * @return bool |
| 39 | */ |
| 40 | public function isValid(): bool { |
| 41 | return !$this->excep; |
| 42 | } |
| 43 | } |