Jderusse\Warmup\Compiler\PhpServerCompiler::waitServer PHP Method

waitServer() public method

public waitServer ( integer $timeout = 10 )
$timeout integer
    public function waitServer(int $timeout = 10)
    {
        $start = time();
        while (time() - $start <= $timeout) {
            usleep(10000);
            if (!$this->process->isRunning()) {
                continue;
            }
            try {
                file_get_contents(sprintf('http://%s/', $this->address));
                return true;
            } catch (\Throwable $e) {
            }
        }
        throw new \RuntimeException('Server is not responding');
    }