From 9fdd07b82d106eb0f931f103bd3442654aee69c0 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 4 Dec 2010 08:58:32 +0000 Subject: [PATCH] Max command length using one line of code Follow-up r76621 code review --- maintenance/mcc.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 ); } -- 2.20.1