mediawiki-extensions-Echo/includes/Services.php
Reedy 8f44150300 And a few more namespaced classes...
Change-Id: I57b56d285bac4b41e81f656f3c1ddceee4620fb5
2023-08-18 22:27:18 +01:00

59 lines
1.7 KiB
PHP

<?php
namespace MediaWiki\Extension\Notifications;
use MediaWiki\Extension\Notifications\Cache\RevisionLocalCache;
use MediaWiki\Extension\Notifications\Cache\TitleLocalCache;
use MediaWiki\Extension\Notifications\Push\NotificationServiceClient;
use MediaWiki\Extension\Notifications\Push\SubscriptionManager;
use MediaWiki\MediaWikiServices;
class Services {
/** @var MediaWikiServices */
private $services;
/** @return Services */
public static function getInstance(): Services {
return new self( MediaWikiServices::getInstance() );
}
/**
* @param MediaWikiServices $services
* @return Services
*/
public static function wrap( MediaWikiServices $services ): Services {
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' );
}
/** @return AttributeManager */
public function getAttributeManager(): AttributeManager {
return $this->services->getService( 'EchoAttributeManager' );
}
/** @return TitleLocalCache */
public function getTitleLocalCache(): TitleLocalCache {
return $this->services->getService( 'EchoTitleLocalCache' );
}
/** @return RevisionLocalCache */
public function getRevisionLocalCache(): RevisionLocalCache {
return $this->services->getService( 'EchoRevisionLocalCache' );
}
}