* http://www.gnu.org/copyleft/gpl.html
*
* @file
- * @author Aaron Schulz
*/
+use Psr\Log\LoggerInterface;
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\NullLogger;
/**
* Base class for reliable event relays
*/
-abstract class EventRelayer {
+abstract class EventRelayer implements LoggerAwareInterface {
+ /** @var LoggerInterface */
+ protected $logger;
+
/**
* @param array $params
*/
public function __construct( array $params ) {
+ $this->logger = new NullLogger();
}
/**
* @return bool Success
*/
final public function notify( $channel, $event ) {
- return $this->doNotify( $channel, array( $event ) );
+ return $this->doNotify( $channel, [ $event ] );
}
/**
return $this->doNotify( $channel, $events );
}
+ public function setLogger( LoggerInterface $logger ) {
+ $this->logger = $logger;
+ }
+
/**
* @param string $channel
* @param array $events List of event data maps
*/
abstract protected function doNotify( $channel, array $events );
}
-
-/**
- * No-op class for publishing messages into a PubSub system
- */
-class EventRelayerNull extends EventRelayer {
- public function doNotify( $channel, array $events ) {
- return true;
- }
-}