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