Merge "Add 3D filetype for STL files"
[lhc/web/wiklou.git] / maintenance / benchmarks / bench_if_switch.php
index 80fd962..843ef7c 100644 (file)
@@ -31,66 +31,80 @@ require_once __DIR__ . '/Benchmarker.php';
  *
  * @ingroup Maintenance
  */
-class bench_if_switch extends Benchmarker {
-
+class BenchIfSwitch extends Benchmarker {
        public function __construct() {
                parent::__construct();
-               $this->mDescription = "Benchmark if elseif... versus switch case.";
+               $this->addDescription( 'Benchmark if elseif... versus switch case.' );
        }
 
        public function execute() {
-               $this->bench( array(
-                       array( 'function' => array( $this, 'doElseIf' ) ),
-                       array( 'function' => array( $this, 'doSwitch' ) ),
-               ));
-               print $this->getFormattedResults();
+               $this->bench( [
+                       [ 'function' => [ $this, 'doElseIf' ] ],
+                       [ 'function' => [ $this, 'doSwitch' ] ],
+               ] );
        }
 
        // bench function 1
-       function doElseIf() {
+       protected function doElseIf() {
                $a = 'z';
-               if( $a == 'a') {}
-               elseif( $a == 'b') {}
-               elseif( $a == 'c') {}
-               elseif( $a == 'd') {}
-               elseif( $a == 'e') {}
-               elseif( $a == 'f') {}
-               elseif( $a == 'g') {}
-               elseif( $a == 'h') {}
-               elseif( $a == 'i') {}
-               elseif( $a == 'j') {}
-               elseif( $a == 'k') {}
-               elseif( $a == 'l') {}
-               elseif( $a == 'm') {}
-               elseif( $a == 'n') {}
-               elseif( $a == 'o') {}
-               elseif( $a == 'p') {}
-               else {}
+               if ( $a == 'a' ) {
+               } elseif ( $a == 'b' ) {
+               } elseif ( $a == 'c' ) {
+               } elseif ( $a == 'd' ) {
+               } elseif ( $a == 'e' ) {
+               } elseif ( $a == 'f' ) {
+               } elseif ( $a == 'g' ) {
+               } elseif ( $a == 'h' ) {
+               } elseif ( $a == 'i' ) {
+               } elseif ( $a == 'j' ) {
+               } elseif ( $a == 'k' ) {
+               } elseif ( $a == 'l' ) {
+               } elseif ( $a == 'm' ) {
+               } elseif ( $a == 'n' ) {
+               } elseif ( $a == 'o' ) {
+               } elseif ( $a == 'p' ) {
+               } else {
+               }
        }
 
        // bench function 2
-       function doSwitch() {
+       protected function doSwitch() {
                $a = 'z';
-               switch( $a ) {
-                       case 'b': break;
-                       case 'c': break;
-                       case 'd': break;
-                       case 'e': break;
-                       case 'f': break;
-                       case 'g': break;
-                       case 'h': break;
-                       case 'i': break;
-                       case 'j': break;
-                       case 'k': break;
-                       case 'l': break;
-                       case 'm': break;
-                       case 'n': break;
-                       case 'o': break;
-                       case 'p': break;
+               switch ( $a ) {
+                       case 'b':
+                               break;
+                       case 'c':
+                               break;
+                       case 'd':
+                               break;
+                       case 'e':
+                               break;
+                       case 'f':
+                               break;
+                       case 'g':
+                               break;
+                       case 'h':
+                               break;
+                       case 'i':
+                               break;
+                       case 'j':
+                               break;
+                       case 'k':
+                               break;
+                       case 'l':
+                               break;
+                       case 'm':
+                               break;
+                       case 'n':
+                               break;
+                       case 'o':
+                               break;
+                       case 'p':
+                               break;
                        default:
                }
        }
 }
 
-$maintClass = 'bench_if_switch';
+$maintClass = 'BenchIfSwitch';
 require_once RUN_MAINTENANCE_IF_MAIN;