MediaWiki master
FormattedRCFeed.php
Go to the documentation of this file.
1<?php
8
10
21abstract class FormattedRCFeed extends RCFeed {
22 private array $params;
23
24 public function __construct( array $params ) {
25 $this->params = $params;
26 }
27
35 abstract public function send( array $feed, $line );
36
42 public function notify( RecentChange $rc, $actionComment = null ) {
43 $params = $this->params;
45 $formatter = is_object( $params['formatter'] ) ? $params['formatter'] : new $params['formatter'];
46
47 $line = $formatter->getLine( $params, $rc, $actionComment );
48 if ( !$line ) {
49 // @codeCoverageIgnoreStart
50 // T109544 - If a feed formatter returns null, this will otherwise cause an
51 // error in at least RedisPubSubFeedEngine. Not sure best to handle this.
52 // @phan-suppress-next-line PhanTypeMismatchReturnProbablyReal
53 return;
54 // @codeCoverageIgnoreEnd
55 }
56 return $this->send( $params, $line );
57 }
58}
60class_alias( FormattedRCFeed::class, 'FormattedRCFeed' );
Base class for RCFeed implementations that use RCFeedFormatter.
notify(RecentChange $rc, $actionComment=null)
send(array $feed, $line)
Send some text to the specified feed.
Utility class for creating and reading rows in the recentchanges table.