MediaWiki REL1_39
EventRelayerGroup.php
Go to the documentation of this file.
1<?php
28 protected $configByChannel = [];
29
31 protected $relayers = [];
32
36 public function __construct( array $config ) {
37 $this->configByChannel = $config;
38 }
39
44 public function getRelayer( $channel ) {
45 $channelKey = isset( $this->configByChannel[$channel] )
46 ? $channel
47 : 'default';
48
49 if ( !isset( $this->relayers[$channelKey] ) ) {
50 if ( !isset( $this->configByChannel[$channelKey] ) ) {
51 throw new UnexpectedValueException( "No config for '$channelKey'" );
52 }
53
54 $config = $this->configByChannel[$channelKey];
55 $class = $config['class'];
56
57 $this->relayers[$channelKey] = new $class( $config );
58 }
59
60 return $this->relayers[$channelKey];
61 }
62}
Factory class for spawning EventRelayer objects using configuration.
__construct(array $config)
EventRelayer[] $relayers
Base class for reliable event relays.