protected function doParseResponse(Server $server)
    {

        try {
            // @codeCoverageIgnoreStart
            // We want to save this server's response to a file (useful for unit testing)
            if (!is_null($this->capture_packets_file)) {
                file_put_contents(
                    $this->capture_packets_file,
                    implode(PHP_EOL . '||' . PHP_EOL, $server->protocol()->packetResponse())
                );
            }
            // @codeCoverageIgnoreEnd

            // Get the server response
            $results = $server->protocol()->processResponse();

            // Check for online before we do anything else
            $results['gq_online'] = (count($results) > 0);
        } catch (ProtocolException $e) {
            // Check to see if we are in debug, if so bubble up the exception
            if ($this->debug) {
                throw new \Exception($e->getMessage(), $e->getCode(), $e);
            }

            // We ignore this server
            $results = [
                'gq_online' => false,
            ];
        }

        // Now add some default stuff
        $results['gq_address'] = (isset($results['gq_address'])) ? $results['gq_address'] : $server->ip();
        $results['gq_port_client'] = $server->portClient();
        $results['gq_port_query'] = (isset($results['gq_port_query'])) ? $results['gq_port_query'] : $server->portQuery();
        $results['gq_protocol'] = $server->protocol()->getProtocol();
        $results['gq_type'] = (string)$server->protocol();
        $results['gq_name'] = $server->protocol()->nameLong();
        $results['gq_transport'] = $server->protocol()->transport();

        // Process the join link
        if (!isset($results['gq_joinlink']) || empty($results['gq_joinlink'])) {
            $results['gq_joinlink'] = $server->getJoinLink();
        }

        return $results;
    }
protected function doParseResponse(Server $server)
    {

        try {
            // @codeCoverageIgnoreStart
            // We want to save this server's response to a file (useful for unit testing)
            if (!is_null($this->capture_packets_file)) {
                file_put_contents(
                    $this->capture_packets_file,
                    implode(PHP_EOL . '||' . PHP_EOL, $server->protocol()->packetResponse())
                );
            }
            // @codeCoverageIgnoreEnd

            // Get the server response
            $results = $server->protocol()->processResponse();

            // Check for online before we do anything else
            $results['gq_online'] = (count($results) > 0);
        } catch (ProtocolException $e) {
            // Check to see if we are in debug, if so bubble up the exception
            if ($this->debug) {
                throw new \Exception($e->getMessage(), $e->getCode(), $e);
            }

            // We ignore this server
            $results = [
                'gq_online' => false,
            ];
        }

        // Now add some default stuff
        $results['gq_address'] = (isset($results['gq_address'])) ? $results['gq_address'] : $server->ip();
        $results['gq_port_client'] = $server->portClient();
        $results['gq_port_query'] = (isset($results['gq_port_query'])) ? $results['gq_port_query'] : $server->portQuery();
        $results['gq_protocol'] = $server->protocol()->getProtocol();
        $results['gq_type'] = (string)$server->protocol();
        $results['gq_name'] = $server->protocol()->nameLong();
        $results['gq_transport'] = $server->protocol()->transport();

        // Process the join link
        if (!isset($results['gq_joinlink']) || empty($results['gq_joinlink'])) {
            $results['gq_joinlink'] = $server->getJoinLink();
        }

        return $results;
    }
protected function doParseResponse ( Server $ server ) { try { // @codeCoverageIgnoreStart // We want to save this server's response to a file (useful for unit testing) if ( ! is_null ( $ this -> capture_packets_file ) ) { file_put_contents ( $ this -> capture_packets_file , implode ( PHP_EOL . '||' . PHP_EOL , $ server -> protocol ( ) -> packetResponse ( ) ) ) ; } // @codeCoverageIgnoreEnd // Get the server response $ results = $ server -> protocol ( ) -> processResponse ( ) ; // Check for online before we do anything else $ results [ 'gq_online' ] = ( count ( $ results ) > 0 ) ; } catch ( ProtocolException $ e ) { // Check to see if we are in debug, if so bubble up the exception if ( $ this -> debug ) { throw new \ Exception ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } // We ignore this server $ results = [ 'gq_online' => false , ] ; } // Now add some default stuff $ results [ 'gq_address' ] = ( isset ( $ results [ 'gq_address' ] ) ) ? $ results [ 'gq_address' ] : $ server -> ip ( ) ; $ results [ 'gq_port_client' ] = $ server -> portClient ( ) ; $ results [ 'gq_port_query' ] = ( isset ( $ results [ 'gq_port_query' ] ) ) ? $ results [ 'gq_port_query' ] : $ server -> portQuery ( ) ; $ results [ 'gq_protocol' ] = $ server -> protocol ( ) -> getProtocol ( ) ; $ results [ 'gq_type' ] = ( string ) $ server -> protocol ( ) ; $ results [ 'gq_name' ] = $ server -> protocol ( ) -> nameLong ( ) ; $ results [ 'gq_transport' ] = $ server -> protocol ( ) -> transport ( ) ; // Process the join link if ( ! isset ( $ results [ 'gq_joinlink' ] ) || empty ( $ results [ 'gq_joinlink' ] ) ) { $ results [ 'gq_joinlink' ] = $ server -> getJoinLink ( ) ; } return $ results ; }
Parse the response for a specific server

@param \GameQ\Server $server

@return array
@throws \Exception
Parse the response for a specific server