addDescription( 'Benchmarks CSSMin.' ); $this->addOption( 'file', 'Path to CSS file (may be gzipped)', false, true ); $this->addOption( 'out', 'Echo output of one run to stdout for inspection', false, false ); } public function execute() { $file = $this->getOption( 'file', __DIR__ . '/cssmin/styles.css' ); $filename = basename( $file ); $css = $this->loadFile( $file ); if ( $this->hasOption( 'out' ) ) { echo "## minify\n\n", CSSMin::minify( $css ), "\n\n"; echo "## remap\n\n", CSSMin::remap( $css, dirname( $file ), 'https://example.org/test/', true ), "\n"; return; } $this->bench( [ "minify ($filename)" => [ 'function' => [ CSSMin::class, 'minify' ], 'args' => [ $css ] ], "remap ($filename)" => [ 'function' => [ CSSMin::class, 'remap' ], 'args' => [ $css, dirname( $file ), 'https://example.org/test/', true ] ], ] ); } } $maintClass = BenchmarkCSSMin::class; require_once RUN_MAINTENANCE_IF_MAIN;