Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
WikimediaCampaignEventsServices
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 getGrantsStore
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getGrantIDLookup
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFluxxClient
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWikiProjectIDLookup
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWikiProjectFullLookup
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare( strict_types=1 );
4
5namespace MediaWiki\Extension\WikimediaCampaignEvents;
6
7use MediaWiki\Extension\WikimediaCampaignEvents\Grants\FluxxClient;
8use MediaWiki\Extension\WikimediaCampaignEvents\Grants\GrantIDLookup;
9use MediaWiki\Extension\WikimediaCampaignEvents\Grants\GrantsStore;
10use MediaWiki\Extension\WikimediaCampaignEvents\WikiProject\WikiProjectFullLookup;
11use MediaWiki\Extension\WikimediaCampaignEvents\WikiProject\WikiProjectIDLookup;
12use MediaWiki\MediaWikiServices;
13use Psr\Container\ContainerInterface;
14
15/**
16 * Global service locator for WikimediaCampaignEventsServices services.
17 * Should only be used where DI is not possible.
18 */
19class 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}