<?php
+use MediaWiki\MediaWikiServices;
+
/**
* Factory class for spawning EventRelayer objects using configuration
*
*/
class EventRelayerGroup {
/** @var array[] */
- protected $configByChannel = array();
+ protected $configByChannel = [];
/** @var EventRelayer[] */
- protected $relayers = array();
-
- /** @var EventRelayerGroup */
- protected static $instance = null;
+ protected $relayers = [];
/**
- * @param Config $config
+ * @param array[] $config Channel configuration
*/
- protected function __construct( Config $config ) {
- $this->configByChannel = $config->get( 'EventRelayerConfig' );
+ public function __construct( array $config ) {
+ $this->configByChannel = $config;
}
/**
+ * @deprecated since 1.27 Use MediaWikiServices::getInstance()->getEventRelayerGroup()
* @return EventRelayerGroup
*/
public static function singleton() {
- if ( !self::$instance ) {
- self::$instance = new self( RequestContext::getMain()->getConfig() );
- }
-
- return self::$instance;
+ return MediaWikiServices::getInstance()->getEventRelayerGroup();
}
/**