Merge "Show dimensions in TraditionalImageGallery"
[lhc/web/wiklou.git] / maintenance / benchmarks / bench_Wikimedia_base_convert.php
index 810937a..86bcc8a 100644 (file)
@@ -34,7 +34,7 @@ require_once __DIR__ . '/Benchmarker.php';
 class BenchWikimediaBaseConvert extends Benchmarker {
        public function __construct() {
                parent::__construct();
-               $this->mDescription = "Benchmark for Wikimedia\\base_convert.";
+               $this->addDescription( 'Benchmark for Wikimedia\base_convert.' );
                $this->addOption( "inbase", "Input base", false, true );
                $this->addOption( "outbase", "Output base", false, true );
                $this->addOption( "length", "Size in digits to generate for input", false, true );
@@ -46,27 +46,25 @@ class BenchWikimediaBaseConvert extends Benchmarker {
                $length = $this->getOption( "length", 128 );
                $number = self::makeRandomNumber( $inbase, $length );
 
-               $this->bench( array(
-                       array(
+               $this->bench( [
+                       [
                                'function' => 'Wikimedia\base_convert',
-                               'args' => array( $number, $inbase, $outbase, 0, true, 'php' )
-                       ),
-                       array(
+                               'args' => [ $number, $inbase, $outbase, 0, true, 'php' ]
+                       ],
+                       [
                                'function' => 'Wikimedia\base_convert',
-                               'args' => array( $number, $inbase, $outbase, 0, true, 'bcmath' )
-                       ),
-                       array(
+                               'args' => [ $number, $inbase, $outbase, 0, true, 'bcmath' ]
+                       ],
+                       [
                                'function' => 'Wikimedia\base_convert',
-                               'args' => array( $number, $inbase, $outbase, 0, true, 'gmp' )
-                       ),
-               ) );
-
-               $this->output( $this->getFormattedResults() );
+                               'args' => [ $number, $inbase, $outbase, 0, true, 'gmp' ]
+                       ],
+               ] );
        }
 
        protected static function makeRandomNumber( $base, $length ) {
-               $baseChars = "0123456789abcdefghijklmnopqrstuvwxyz";
-               $res = "";
+               $baseChars = '0123456789abcdefghijklmnopqrstuvwxyz';
+               $res = '';
                for ( $i = 0; $i < $length; $i++ ) {
                        $res .= $baseChars[mt_rand( 0, $base - 1 )];
                }