DebugKit\Shell\BenchmarkShell::main PHP Метод

main() публичный Метод

Main execution of shell
public main ( ) : void
Результат void
    public function main()
    {
        $url = $this->args[0];
        $defaults = ['t' => 100, 'n' => 10];
        $options = array_merge($defaults, $this->params);
        $times = [];
        $this->out(Text::insert(__d('debug_kit', '-> Testing :url'), compact('url')));
        $this->out("");
        for ($i = 0; $i < $options['n']; $i++) {
            if (floor($options['t'] - array_sum($times)) <= 0 || $options['n'] <= 1) {
                break;
            }
            $start = microtime(true);
            file_get_contents($url);
            $stop = microtime(true);
            $times[] = $stop - $start;
        }
        $this->_results($times);
    }