| 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 |
|
| 14 |
private $services; |
| 15 |
|
| 16 |
public static function getInstance(): Services { |
| 17 |
return new self( MediaWikiServices::getInstance() ); |
| 18 |
} |
| 19 |
|
| 20 |
public static function wrap( MediaWikiServices $services ): Services { |
| 21 |
return new self( $services ); |
| 22 |
} |
| 23 |
|
| 24 |
public function __construct( MediaWikiServices $services ) { |
| 25 |
$this->services = $services; |
| 26 |
} |
| 27 |
|
| 28 |
public function getPushNotificationServiceClient(): NotificationServiceClient { |
| 29 |
return $this->services->getService( 'EchoPushNotificationServiceClient' ); |
| 30 |
} |
| 31 |
|
| 32 |
public function getPushSubscriptionManager(): SubscriptionManager { |
| 33 |
return $this->services->getService( 'EchoPushSubscriptionManager' ); |
| 34 |
} |
| 35 |
|
| 36 |
public function getAttributeManager(): AttributeManager { |
| 37 |
return $this->services->getService( 'EchoAttributeManager' ); |
| 38 |
} |
| 39 |
|
| 40 |
public function getTitleLocalCache(): TitleLocalCache { |
| 41 |
return $this->services->getService( 'EchoTitleLocalCache' ); |
| 42 |
} |
| 43 |
|
| 44 |
public function getRevisionLocalCache(): RevisionLocalCache { |
| 45 |
return $this->services->getService( 'EchoRevisionLocalCache' ); |
| 46 |
} |
| 47 |
} |