Debian Codegraph @

extensions/AbuseFilter/includes/Parser/ParserStatus.php

raw symbols SCIP
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 /** @var ExceptionBase|null */
10 protected $excep;
11 /** @var UserVisibleWarning[] */
12 protected $warnings;
13 /** @var int */
14 protected $condsUsed;
15
16 /**
17 * @param ExceptionBase|null $excep An exception thrown while parsing, or null if it parsed correctly
18 * @param UserVisibleWarning[] $warnings
19 * @param int $condsUsed
20 */
21 public function __construct(
22 ?ExceptionBase $excep,
23 array $warnings,
24 int $condsUsed
25 ) {
26 $this->excep = $excep;
27 $this->warnings = $warnings;
28 $this->condsUsed = $condsUsed;
29 }
30
31 /**
32 * @return ExceptionBase|null
33 */
34 public function getException(): ?ExceptionBase {
35 return $this->excep;
36 }
37
38 /**
39 * @return UserVisibleWarning[]
40 */
41 public function getWarnings(): array {
42 return $this->warnings;
43 }
44
45 /**
46 * @return int
47 */
48 public function getCondsUsed(): int {
49 return $this->condsUsed;
50 }
51
52 /**
53 * Whether the parsing/evaluation happened successfully.
54 * @return bool
55 */
56 public function isValid(): bool {
57 return !$this->excep;
58 }
59 }