protected function getServer()
    {
        $servers = array();

        if (isset($this->globals['production']) && (true === $this->globals['production'])) {
            $servers[] = $this->servers['primary'];
            $servers[] = $this->servers['secondary'];
        } else {
            $servers[] = $this->servers['preprod'];
        }

        foreach ($servers as $server) {
            $doc = new \DOMDocument();
            $doc->loadHTML($this->getWebPage(sprintf(
                '%s://%s%s',
                $server['protocol'],
                $server['host'],
                $server['test_path']
            )));
            $element = $doc->getElementById('server_status');

            if ($element && 'OK' == $element->textContent) {
                return $server;
            }
        }

        throw new RuntimeException('No server available.');
    }
protected function getServer()
    {
        $servers = array();

        if (isset($this->globals['production']) && (true === $this->globals['production'])) {
            $servers[] = $this->servers['primary'];
            $servers[] = $this->servers['secondary'];
        } else {
            $servers[] = $this->servers['preprod'];
        }

        foreach ($servers as $server) {
            $doc = new \DOMDocument();
            $doc->loadHTML($this->getWebPage(sprintf(
                '%s://%s%s',
                $server['protocol'],
                $server['host'],
                $server['test_path']
            )));
            $element = $doc->getElementById('server_status');

            if ($element && 'OK' == $element->textContent) {
                return $server;
            }
        }

        throw new RuntimeException('No server available.');
    }
protected function getServer ( ) { $ servers = array ( ) ; if ( isset ( $ this -> globals [ 'production' ] ) && ( true === $ this -> globals [ 'production' ] ) ) { $ servers [ ] = $ this -> servers [ 'primary' ] ; $ servers [ ] = $ this -> servers [ 'secondary' ] ; } else { $ servers [ ] = $ this -> servers [ 'preprod' ] ; } foreach ( $ servers as $ server ) { $ doc = new \ DOMDocument ( ) ; $ doc -> loadHTML ( $ this -> getWebPage ( sprintf ( '%s://%s%s' , $ server [ 'protocol' ] , $ server [ 'host' ] , $ server [ 'test_path' ] ) ) ) ; $ element = $ doc -> getElementById ( 'server_status' ) ; if ( $ element && 'OK' == $ element -> textContent ) { return $ server ; } } throw new RuntimeException ( 'No server available.' ) ; }
Returns the url of an available server.

@return array

@throws InvalidArgumentException If the specified environment is not valid (dev/prod).
@throws RuntimeException         If no server is available.
Returns the url of an available server .