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