From: Antoine Musso Date: Sat, 4 Dec 2010 08:58:32 +0000 (+0000) Subject: Max command length using one line of code X-Git-Tag: 1.31.0-rc.0~33582 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=9fdd07b82d106eb0f931f103bd3442654aee69c0;p=lhc%2Fweb%2Fwiklou.git Max command length using one line of code Follow-up r76621 code review --- diff --git a/maintenance/mcc.php b/maintenance/mcc.php index 92f6863522..a8c79a7259 100644 --- a/maintenance/mcc.php +++ b/maintenance/mcc.php @@ -31,10 +31,7 @@ function mccShowHelp( $command ) { $command = 'fullhelp'; } if ( $command === 'fullhelp' ) { - $max_cmd_len = 0; - foreach( array_keys( $commandList ) as $cmd ) { - $max_cmd_len = max( $max_cmd_len, strlen($cmd) ); - } + $max_cmd_len = max( array_map( 'strlen', array_keys( $commandList ) ) ); foreach ( $commandList as $cmd => $desc ) { printf( "%-{$max_cmd_len}s: %s\n", $cmd, $desc ); }