MediaWiki master
FormattedRCFeed.php
Go to the documentation of this file.
1<?php
22
24
35abstract class FormattedRCFeed extends RCFeed {
36 private array $params;
37
38 public function __construct( array $params ) {
39 $this->params = $params;
40 }
41
49 abstract public function send( array $feed, $line );
50
56 public function notify( RecentChange $rc, $actionComment = null ) {
57 $params = $this->params;
59 $formatter = is_object( $params['formatter'] ) ? $params['formatter'] : new $params['formatter'];
60
61 $line = $formatter->getLine( $params, $rc, $actionComment );
62 if ( !$line ) {
63 // @codeCoverageIgnoreStart
64 // T109544 - If a feed formatter returns null, this will otherwise cause an
65 // error in at least RedisPubSubFeedEngine. Not sure best to handle this.
66 // @phan-suppress-next-line PhanTypeMismatchReturnProbablyReal
67 return;
68 // @codeCoverageIgnoreEnd
69 }
70 return $this->send( $params, $line );
71 }
72}
74class_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.