Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
WikimediaCampaignEventsServices | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
getGrantsStore | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getGrantIDLookup | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getFluxxClient | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getWikiProjectIDLookup | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getWikiProjectFullLookup | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare( strict_types=1 ); |
4 | |
5 | namespace MediaWiki\Extension\WikimediaCampaignEvents; |
6 | |
7 | use MediaWiki\Extension\WikimediaCampaignEvents\Grants\FluxxClient; |
8 | use MediaWiki\Extension\WikimediaCampaignEvents\Grants\GrantIDLookup; |
9 | use MediaWiki\Extension\WikimediaCampaignEvents\Grants\GrantsStore; |
10 | use MediaWiki\Extension\WikimediaCampaignEvents\WikiProject\WikiProjectFullLookup; |
11 | use MediaWiki\Extension\WikimediaCampaignEvents\WikiProject\WikiProjectIDLookup; |
12 | use MediaWiki\MediaWikiServices; |
13 | use Psr\Container\ContainerInterface; |
14 | |
15 | /** |
16 | * Global service locator for WikimediaCampaignEventsServices services. |
17 | * Should only be used where DI is not possible. |
18 | */ |
19 | class WikimediaCampaignEventsServices { |
20 | public static function getGrantsStore( ?ContainerInterface $services = null ): GrantsStore { |
21 | return ( $services ?? MediaWikiServices::getInstance() )->get( GrantsStore::SERVICE_NAME ); |
22 | } |
23 | |
24 | public static function getGrantIDLookup( ?ContainerInterface $services = null ): GrantIDLookup { |
25 | return ( $services ?? MediaWikiServices::getInstance() )->get( GrantIDLookup::SERVICE_NAME ); |
26 | } |
27 | |
28 | public static function getFluxxClient( ?ContainerInterface $services = null ): FluxxClient { |
29 | return ( $services ?? MediaWikiServices::getInstance() )->get( FluxxClient::SERVICE_NAME ); |
30 | } |
31 | |
32 | public static function getWikiProjectIDLookup( ?ContainerInterface $services = null ): WikiProjectIDLookup { |
33 | return ( $services ?? MediaWikiServices::getInstance() )->get( WikiProjectIDLookup::SERVICE_NAME ); |
34 | } |
35 | |
36 | public static function getWikiProjectFullLookup( ?ContainerInterface $services = null ): WikiProjectFullLookup { |
37 | return ( $services ?? MediaWikiServices::getInstance() )->get( WikiProjectFullLookup::SERVICE_NAME ); |
38 | } |
39 | } |