summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Echo/includes/EchoServices.php')
-rw-r--r--Echo/includes/EchoServices.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/Echo/includes/EchoServices.php b/Echo/includes/EchoServices.php
new file mode 100644
index 00000000..7633d07b
--- /dev/null
+++ b/Echo/includes/EchoServices.php
@@ -0,0 +1,40 @@
+<?php
+
+use EchoPush\NotificationServiceClient;
+use EchoPush\SubscriptionManager;
+use MediaWiki\MediaWikiServices;
+
+class EchoServices {
+
+ /** @var MediaWikiServices */
+ private $services;
+
+ /** @return EchoServices */
+ public static function getInstance(): EchoServices {
+ return new self( MediaWikiServices::getInstance() );
+ }
+
+ /**
+ * @param MediaWikiServices $services
+ * @return EchoServices
+ */
+ public static function wrap( MediaWikiServices $services ): EchoServices {
+ return new self( $services );
+ }
+
+ /** @param MediaWikiServices $services */
+ public function __construct( MediaWikiServices $services ) {
+ $this->services = $services;
+ }
+
+ /** @return NotificationServiceClient */
+ public function getPushNotificationServiceClient(): NotificationServiceClient {
+ return $this->services->getService( 'EchoPushNotificationServiceClient' );
+ }
+
+ /** @return SubscriptionManager */
+ public function getPushSubscriptionManager(): SubscriptionManager {
+ return $this->services->getService( 'EchoPushSubscriptionManager' );
+ }
+
+}