r80804 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80803‎ | r80804 | r80805 >
Date:10:28, 23 January 2011
Author:reedy
Status:ok
Tags:
Comment:
Swap multiple if to switch statement
Modified paths:
  • /trunk/extensions/CentralAuth/CentralAuth.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/CentralAuth.php
@@ -248,20 +248,24 @@
249249
250250 function efHandleWikiSetLogEntry( $type, $action, $title, $skin, $params, $filterWikilinks = false ) {
251251 $link = $skin ? $skin->makeLinkObj( $title, $params[0] ) : $params[0];
252 - if ( $action == 'newset' ) {
253 - $args = array( WikiSet::formatType( $params[1] ), $params[2] );
 252+
 253+ switch( $action ) {
 254+ case 'newset':
 255+ $args = array( WikiSet::formatType( $params[1] ), $params[2] );
 256+ break;
 257+ case 'setrename':
 258+ $args = array( $params[1] );
 259+ break;
 260+ case 'setnewtype':
 261+ $args = array( WikiSet::formatType( $params[1] ), WikiSet::formatType( $params[2] ) );
 262+ break;
 263+ case 'setchange':
 264+ $args = array( $params[1]
 265+ ? $params[1] : wfMsg( 'rightsnone' ), $params[2] ? $params[2] : wfMsg( 'rightsnone' ) );
 266+ break;
 267+ default: //'deleteset'
 268+ $args = array();
254269 }
255 - if ( $action == 'setrename' ) {
256 - $args = array( $params[1] );
257 - }
258 - if ( $action == 'setnewtype' ) {
259 - $args = array( WikiSet::formatType( $params[1] ), WikiSet::formatType( $params[2] ) );
260 - }
261 - if ( $action == 'setchange' ) {
262 - $args = array( $params[1] ? $params[1] : wfMsg( 'rightsnone' ), $params[2] ? $params[2] : wfMsg( 'rightsnone' ) );
263 - }
264 - if ( $action == 'deleteset' ) {
265 - $args = array();
266 - }
 270+
267271 return wfMsgReal( "centralauth-rightslog-entry-{$action}", array_merge( array( $link ), $args ), true, !$skin );
268272 }

Status & tagging log