MediaWiki  master
EventRelayer.php
Go to the documentation of this file.
1 <?php
20 use Psr\Log\LoggerAwareInterface;
21 use Psr\Log\LoggerInterface;
22 use Psr\Log\NullLogger;
23 
29 abstract class EventRelayer implements LoggerAwareInterface {
31  protected $logger;
32 
38  public function __construct( array $params ) {
39  $this->logger = new NullLogger();
40  }
41 
47  final public function notify( $channel, $event ) {
48  return $this->doNotify( $channel, [ $event ] );
49  }
50 
56  final public function notifyMulti( $channel, $events ) {
57  return $this->doNotify( $channel, $events );
58  }
59 
60  public function setLogger( LoggerInterface $logger ) {
61  $this->logger = $logger;
62  }
63 
69  abstract protected function doNotify( $channel, array $events );
70 }
EventRelayer\notify
notify( $channel, $event)
Definition: EventRelayer.php:47
EventRelayer\__construct
__construct(array $params)
Stable to call.
Definition: EventRelayer.php:38
EventRelayer\$logger
LoggerInterface $logger
Definition: EventRelayer.php:31
EventRelayer\notifyMulti
notifyMulti( $channel, $events)
Definition: EventRelayer.php:56
EventRelayer\setLogger
setLogger(LoggerInterface $logger)
Definition: EventRelayer.php:60
EventRelayer\doNotify
doNotify( $channel, array $events)
EventRelayer
Base class for reliable event relays.
Definition: EventRelayer.php:29