2020-05-15 17:19:03 +00:00
|
|
|
<?php
|
|
|
|
|
2020-05-22 22:02:34 +00:00
|
|
|
use EchoPush\NotificationServiceClient;
|
2020-05-15 17:19:03 +00:00
|
|
|
use EchoPush\SubscriptionManager;
|
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
|
|
|
class EchoServices {
|
|
|
|
|
|
|
|
/** @var MediaWikiServices */
|
|
|
|
private $services;
|
|
|
|
|
|
|
|
/** @return EchoServices */
|
|
|
|
public static function getInstance(): EchoServices {
|
|
|
|
return new self( MediaWikiServices::getInstance() );
|
|
|
|
}
|
|
|
|
|
2020-05-22 22:02:34 +00:00
|
|
|
/**
|
|
|
|
* @param MediaWikiServices $services
|
|
|
|
* @return EchoServices
|
|
|
|
*/
|
|
|
|
public static function wrap( MediaWikiServices $services ): EchoServices {
|
|
|
|
return new self( $services );
|
|
|
|
}
|
|
|
|
|
2020-05-15 17:19:03 +00:00
|
|
|
/** @param MediaWikiServices $services */
|
|
|
|
public function __construct( MediaWikiServices $services ) {
|
|
|
|
$this->services = $services;
|
|
|
|
}
|
|
|
|
|
2020-05-22 22:02:34 +00:00
|
|
|
/** @return NotificationServiceClient */
|
|
|
|
public function getPushNotificationServiceClient(): NotificationServiceClient {
|
|
|
|
return $this->services->getService( 'EchoPushNotificationServiceClient' );
|
|
|
|
}
|
|
|
|
|
2020-05-15 17:19:03 +00:00
|
|
|
/** @return SubscriptionManager */
|
|
|
|
public function getPushSubscriptionManager(): SubscriptionManager {
|
|
|
|
return $this->services->getService( 'EchoPushSubscriptionManager' );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|