MediaWiki  master
FormattedRCFeed.php
Go to the documentation of this file.
1 <?php
26 abstract class FormattedRCFeed extends RCFeed {
27  private $params;
28 
35  public function __construct( array $params = [] ) {
36  $this->params = $params;
37  }
38 
46  abstract public function send( array $feed, $line );
47 
53  public function notify( RecentChange $rc, $actionComment = null ) {
56  // @phan-suppress-next-line PhanTypeExpectedObjectOrClassName
57  $formatter = is_object( $params['formatter'] ) ? $params['formatter'] : new $params['formatter'];
58 
59  $line = $formatter->getLine( $params, $rc, $actionComment );
60  if ( !$line ) {
61  // @codeCoverageIgnoreStart
62  // T109544 - If a feed formatter returns null, this will otherwise cause an
63  // error in at least RedisPubSubFeedEngine. Not sure best to handle this.
64  return;
65  // @codeCoverageIgnoreEnd
66  }
67  return $this->send( $params, $line );
68  }
69 }
notify(RecentChange $rc, $actionComment=null)
send(array $feed, $line)
Send some text to the specified feed.
$line
Definition: cdb.php:59
Base class for RC feed engines that send messages in a freely configurable format to a uri-addressed ...
__construct(array $params=[])