MediaWiki REL1_40
FormattedRCFeed.php
Go to the documentation of this file.
1<?php
30abstract class FormattedRCFeed extends RCFeed {
31 private $params;
32
36 public function __construct( array $params ) {
37 $this->params = $params;
38 }
39
47 abstract public function send( array $feed, $line );
48
54 public function notify( RecentChange $rc, $actionComment = null ) {
55 $params = $this->params;
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 // @phan-suppress-next-line PhanTypeMismatchReturnProbablyReal
65 return;
66 // @codeCoverageIgnoreEnd
67 }
68 return $this->send( $params, $line );
69 }
70}
71
77class_alias( FormattedRCFeed::class, 'RCFeedEngine' );
Base class for RCFeed implementations that use RCFeedFormatter.
notify(RecentChange $rc, $actionComment=null)
__construct(array $params)
send(array $feed, $line)
Send some text to the specified feed.
Utility class for creating new RC entries.