Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
ContentThreadItemSetStatus | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
wrap | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getValueOrThrow | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\DiscussionTools; |
4 | |
5 | use MediaWiki\Status\Status; |
6 | use StatusValue; |
7 | use Wikimedia\NormalizedException\NormalizedException; |
8 | |
9 | class ContentThreadItemSetStatus extends StatusValue { |
10 | |
11 | /** |
12 | * Convenience method. |
13 | */ |
14 | public static function wrap( StatusValue $other ): self { |
15 | return ( new self )->merge( $other, true ); |
16 | } |
17 | |
18 | /** |
19 | * Like getValue(), but will throw if the value is null. Check isOK() first to avoid errors. |
20 | */ |
21 | public function getValueOrThrow(): ContentThreadItemSet { |
22 | $value = $this->getValue(); |
23 | if ( $value === null ) { |
24 | throw new NormalizedException( ...Status::wrap( $this )->getPsr3MessageAndContext() ); |
25 | } |
26 | return $value; |
27 | } |
28 | |
29 | } |