Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ExpensiveUserImpactFallbackTrait
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 getUserImpact
n/a
0 / 0
n/a
0 / 0
0
 getExpensiveUserImpact
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace GrowthExperiments\UserImpact;
4
5use MediaWiki\User\UserIdentity;
6use Wikimedia\Rdbms\IDBAccessObject;
7
8trait 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}