summaryrefslogtreecommitdiff
blob: 7633d07bc8375fc03b818dff82464d82db2877ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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' );
	}

}