Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
83.33% |
5 / 6 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
CentralAuthGlobalRegistrationProvider | |
83.33% |
5 / 6 |
|
0.00% |
0 / 1 |
4.07 | |
0.00% |
0 / 1 |
fetchRegistration | |
83.33% |
5 / 6 |
|
0.00% |
0 / 1 |
4.07 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\CentralAuth\User; |
4 | |
5 | use MediaWiki\User\Registration\IUserRegistrationProvider; |
6 | use MediaWiki\User\UserIdentity; |
7 | |
8 | class CentralAuthGlobalRegistrationProvider implements IUserRegistrationProvider { |
9 | |
10 | /** @var string */ |
11 | public const TYPE = 'centralauth'; |
12 | |
13 | /** |
14 | * @inheritDoc |
15 | */ |
16 | public function fetchRegistration( UserIdentity $user ) { |
17 | if ( !$user->isRegistered() ) { |
18 | return false; |
19 | } |
20 | |
21 | $centralUser = CentralAuthUser::getInstance( $user ); |
22 | if ( $centralUser->exists() && $centralUser->isAttached() ) { |
23 | return $centralUser->getRegistration(); |
24 | } |
25 | return null; |
26 | } |
27 | } |