Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
75.00% |
6 / 8 |
|
75.00% |
6 / 8 |
CRAP | |
0.00% |
0 / 1 |
Services | |
75.00% |
6 / 8 |
|
75.00% |
6 / 8 |
9.00 | |
0.00% |
0 / 1 |
getInstance | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
wrap | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getPushNotificationServiceClient | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getPushSubscriptionManager | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getAttributeManager | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTitleLocalCache | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getRevisionLocalCache | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\Notifications; |
4 | |
5 | use MediaWiki\Extension\Notifications\Cache\RevisionLocalCache; |
6 | use MediaWiki\Extension\Notifications\Cache\TitleLocalCache; |
7 | use MediaWiki\Extension\Notifications\Push\NotificationServiceClient; |
8 | use MediaWiki\Extension\Notifications\Push\SubscriptionManager; |
9 | use MediaWiki\MediaWikiServices; |
10 | |
11 | class Services { |
12 | |
13 | /** @var MediaWikiServices */ |
14 | private $services; |
15 | |
16 | /** @return Services */ |
17 | public static function getInstance(): Services { |
18 | return new self( MediaWikiServices::getInstance() ); |
19 | } |
20 | |
21 | /** |
22 | * @param MediaWikiServices $services |
23 | * @return Services |
24 | */ |
25 | public static function wrap( MediaWikiServices $services ): Services { |
26 | return new self( $services ); |
27 | } |
28 | |
29 | /** @param MediaWikiServices $services */ |
30 | public function __construct( MediaWikiServices $services ) { |
31 | $this->services = $services; |
32 | } |
33 | |
34 | /** @return NotificationServiceClient */ |
35 | public function getPushNotificationServiceClient(): NotificationServiceClient { |
36 | return $this->services->getService( 'EchoPushNotificationServiceClient' ); |
37 | } |
38 | |
39 | /** @return SubscriptionManager */ |
40 | public function getPushSubscriptionManager(): SubscriptionManager { |
41 | return $this->services->getService( 'EchoPushSubscriptionManager' ); |
42 | } |
43 | |
44 | /** @return AttributeManager */ |
45 | public function getAttributeManager(): AttributeManager { |
46 | return $this->services->getService( 'EchoAttributeManager' ); |
47 | } |
48 | |
49 | /** @return TitleLocalCache */ |
50 | public function getTitleLocalCache(): TitleLocalCache { |
51 | return $this->services->getService( 'EchoTitleLocalCache' ); |
52 | } |
53 | |
54 | /** @return RevisionLocalCache */ |
55 | public function getRevisionLocalCache(): RevisionLocalCache { |
56 | return $this->services->getService( 'EchoRevisionLocalCache' ); |
57 | } |
58 | } |