Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
75.00% |
6 / 8 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
ClaimStore | |
75.00% |
6 / 8 |
|
50.00% |
1 / 2 |
3.14 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getClaims | |
66.67% |
4 / 6 |
|
0.00% |
0 / 1 |
2.15 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\OAuth\Repository; |
4 | |
5 | use League\OAuth2\Server\Entities\ClientEntityInterface; |
6 | use League\OAuth2\Server\Repositories\ClaimRepositoryInterface; |
7 | use LogicException; |
8 | use MediaWiki\Extension\OAuth\Entity\MWClientEntityInterface; |
9 | use MediaWiki\Extension\OAuth\HookRunner; |
10 | use MediaWiki\MediaWikiServices; |
11 | |
12 | class ClaimStore implements ClaimRepositoryInterface { |
13 | |
14 | /** |
15 | * @var HookRunner |
16 | */ |
17 | private $hookRunner; |
18 | |
19 | public function __construct() { |
20 | $hookContainer = MediaWikiServices::getInstance()->getHookContainer(); |
21 | $this->hookRunner = new HookRunner( $hookContainer ); |
22 | } |
23 | |
24 | /** |
25 | * @inheritDoc |
26 | */ |
27 | public function getClaims( |
28 | string $grantType, ClientEntityInterface $clientEntity, $userIdentifier = null |
29 | ) { |
30 | if ( !( $clientEntity instanceof MWClientEntityInterface ) ) { |
31 | throw new LogicException( '$clientEntity must be instance of ' . |
32 | MWClientEntityInterface::class . ', got ' . get_class( $clientEntity ) . ' instead' ); |
33 | } |
34 | |
35 | $privateClaims = []; |
36 | $this->hookRunner->onOAuthClaimStoreGetClaims( $grantType, $clientEntity, $privateClaims ); |
37 | |
38 | return $privateClaims; |
39 | } |
40 | } |