MediaWiki  1.34.0
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 }
FormattedRCFeed\__construct
__construct(array $params=[])
Definition: FormattedRCFeed.php:35
RecentChange
Utility class for creating new RC entries.
Definition: RecentChange.php:70
FormattedRCFeed\send
send(array $feed, $line)
Send some text to the specified feed.
FormattedRCFeed\$params
$params
Definition: FormattedRCFeed.php:27
FormattedRCFeed\notify
notify(RecentChange $rc, $actionComment=null)
Definition: FormattedRCFeed.php:53
$line
$line
Definition: cdb.php:59
FormattedRCFeed
Base class for RC feed engines that send messages in a freely configurable format to a uri-addressed ...
Definition: FormattedRCFeed.php:26
RCFeed
Definition: RCFeed.php:25