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