X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Frcfeed%2FMachineReadableRCFeedFormatter.php;h=a90d648eb345b1885e99c588f58ae1a00c280bd3;hb=e0b2787dae749ba3d4cb18bc9b3fe789db69046f;hp=f524361ab1cefb01bf3c5c117f18088de4c45a4b;hpb=3368cccde53732c1278f51632e69b9865c4ee6ba;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/rcfeed/MachineReadableRCFeedFormatter.php b/includes/rcfeed/MachineReadableRCFeedFormatter.php index f524361ab1..a90d648eb3 100644 --- a/includes/rcfeed/MachineReadableRCFeedFormatter.php +++ b/includes/rcfeed/MachineReadableRCFeedFormatter.php @@ -36,11 +36,15 @@ abstract class MachineReadableRCFeedFormatter implements RCFeedFormatter { /** * Generates a notification that can be easily interpreted by a machine. * @see RCFeedFormatter::getLine + * @param array $feed + * @param RecentChange $rc + * @param string|null $actionComment + * @return string|null */ public function getLine( array $feed, RecentChange $rc, $actionComment ) { global $wgCanonicalServer, $wgServerName, $wgScriptPath; - $packet = array( + $packet = [ // Usually, RC ID is exposed only for patrolling purposes, // but there is no real reason not to expose it in other cases, // and I can see how this may be potentially useful for clients. @@ -52,7 +56,7 @@ abstract class MachineReadableRCFeedFormatter implements RCFeedFormatter { 'timestamp' => (int)wfTimestamp( TS_UNIX, $rc->getAttribute( 'rc_timestamp' ) ), 'user' => $rc->getAttribute( 'rc_user_text' ), 'bot' => (bool)$rc->getAttribute( 'rc_bot' ), - ); + ]; if ( isset( $feed['channel'] ) ) { $packet['channel'] = $feed['channel']; @@ -70,19 +74,19 @@ abstract class MachineReadableRCFeedFormatter implements RCFeedFormatter { switch ( $type ) { case RC_EDIT: - $packet['length'] = array( + $packet['length'] = [ 'old' => $rc->getAttribute( 'rc_old_len' ), 'new' => $rc->getAttribute( 'rc_new_len' ) - ); - $packet['revision'] = array( + ]; + $packet['revision'] = [ 'old' => $rc->getAttribute( 'rc_last_oldid' ), 'new' => $rc->getAttribute( 'rc_this_oldid' ) - ); + ]; break; case RC_NEW: - $packet['length'] = array( 'old' => null, 'new' => $rc->getAttribute( 'rc_new_len' ) ); - $packet['revision'] = array( 'old' => null, 'new' => $rc->getAttribute( 'rc_this_oldid' ) ); + $packet['length'] = [ 'old' => null, 'new' => $rc->getAttribute( 'rc_new_len' ) ]; + $packet['revision'] = [ 'old' => null, 'new' => $rc->getAttribute( 'rc_this_oldid' ) ]; break; case RC_LOG: @@ -98,7 +102,7 @@ abstract class MachineReadableRCFeedFormatter implements RCFeedFormatter { $params !== false ) { // From ApiQueryLogEvents::addLogParams - $logParams = array(); + $logParams = []; // Keys like "4::paramname" can't be used for output so we change them to "paramname" foreach ( $params as $key => $value ) { if ( strpos( $key, ':' ) === false ) {