2020-05-15 17:19:03 +00:00
|
|
|
<?php
|
|
|
|
|
2022-11-13 07:53:42 +00:00
|
|
|
namespace MediaWiki\Extension\Notifications;
|
|
|
|
|
2023-08-14 15:36:07 +00:00
|
|
|
use MediaWiki\Extension\Notifications\Cache\RevisionLocalCache;
|
|
|
|
use MediaWiki\Extension\Notifications\Cache\TitleLocalCache;
|
2022-04-08 00:38:27 +00:00
|
|
|
use MediaWiki\Extension\Notifications\Push\NotificationServiceClient;
|
|
|
|
use MediaWiki\Extension\Notifications\Push\SubscriptionManager;
|
2020-05-15 17:19:03 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
2022-11-13 07:53:42 +00:00
|
|
|
class Services {
|
2020-05-15 17:19:03 +00:00
|
|
|
|
|
|
|
/** @var MediaWikiServices */
|
|
|
|
private $services;
|
|
|
|
|
2022-11-13 07:53:42 +00:00
|
|
|
/** @return Services */
|
|
|
|
public static function getInstance(): Services {
|
2020-05-15 17:19:03 +00:00
|
|
|
return new self( MediaWikiServices::getInstance() );
|
|
|
|
}
|
|
|
|
|
2020-05-22 22:02:34 +00:00
|
|
|
/**
|
|
|
|
* @param MediaWikiServices $services
|
2022-11-13 07:53:42 +00:00
|
|
|
* @return Services
|
2020-05-22 22:02:34 +00:00
|
|
|
*/
|
2022-11-13 07:53:42 +00:00
|
|
|
public static function wrap( MediaWikiServices $services ): Services {
|
2020-05-22 22:02:34 +00:00
|
|
|
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' );
|
|
|
|
}
|
|
|
|
|
2022-11-12 07:19:00 +00:00
|
|
|
/** @return AttributeManager */
|
|
|
|
public function getAttributeManager(): AttributeManager {
|
2021-02-25 01:55:40 +00:00
|
|
|
return $this->services->getService( 'EchoAttributeManager' );
|
|
|
|
}
|
|
|
|
|
2023-08-14 15:36:07 +00:00
|
|
|
/** @return TitleLocalCache */
|
|
|
|
public function getTitleLocalCache(): TitleLocalCache {
|
|
|
|
return $this->services->getService( 'EchoTitleLocalCache' );
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return RevisionLocalCache */
|
|
|
|
public function getRevisionLocalCache(): RevisionLocalCache {
|
|
|
|
return $this->services->getService( 'EchoRevisionLocalCache' );
|
|
|
|
}
|
2020-05-15 17:19:03 +00:00
|
|
|
}
|