Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
ExpensiveUserImpactFallbackTrait | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
getUserImpact | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
getExpensiveUserImpact | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace GrowthExperiments\UserImpact; |
4 | |
5 | use MediaWiki\User\UserIdentity; |
6 | use Wikimedia\Rdbms\IDBAccessObject; |
7 | |
8 | trait ExpensiveUserImpactFallbackTrait { |
9 | |
10 | /** @inheritDoc */ |
11 | abstract public function getUserImpact( |
12 | UserIdentity $user, int $flags = IDBAccessObject::READ_NORMAL |
13 | ): ?UserImpact; |
14 | |
15 | /** @inheritDoc */ |
16 | public function getExpensiveUserImpact( |
17 | UserIdentity $user, |
18 | int $flags = IDBAccessObject::READ_NORMAL, |
19 | array $priorityArticles = [] |
20 | ): ?ExpensiveUserImpact { |
21 | $userImpact = $this->getUserImpact( $user, $flags ); |
22 | if ( $userImpact instanceof ExpensiveUserImpact ) { |
23 | return $userImpact; |
24 | } |
25 | return null; |
26 | } |
27 | |
28 | } |