public function request()
    {
        if ('' !== $this->defaultOptions['callback']) {
            $msg = 'Cannot run query when callback is set. Get query using getRawRequestUrl().';
            throw new \BadMethodCallException($msg);
        }

        $this->buildSpecificRequestUri();

        try {
            if (null === $content = $this->getHttpClient()->getContent($this->getRawRequestUrl())) {
                throw new \RuntimeException('The request was not successful.');
            }
        } catch (\RuntimeException $e) {
            throw new \RuntimeException('The request was not successful.');
        }

        if (self::RESULT_ARRAY === $this->resultFormat) {
            $resultSet = json_decode($content, true);
            $resultSet = new ResultSet($resultSet['results']);

            return $resultSet;
        } else {
            // convert JSON-string to array
            $jsonString = json_decode($content);

            $this->resultCount = (integer) $jsonString->resultCount;
            $this->results     = json_encode($jsonString->results);

            return $this->results;
        }
    }
public function request()
    {
        if ('' !== $this->defaultOptions['callback']) {
            $msg = 'Cannot run query when callback is set. Get query using getRawRequestUrl().';
            throw new \BadMethodCallException($msg);
        }

        $this->buildSpecificRequestUri();

        try {
            if (null === $content = $this->getHttpClient()->getContent($this->getRawRequestUrl())) {
                throw new \RuntimeException('The request was not successful.');
            }
        } catch (\RuntimeException $e) {
            throw new \RuntimeException('The request was not successful.');
        }

        if (self::RESULT_ARRAY === $this->resultFormat) {
            $resultSet = json_decode($content, true);
            $resultSet = new ResultSet($resultSet['results']);

            return $resultSet;
        } else {
            // convert JSON-string to array
            $jsonString = json_decode($content);

            $this->resultCount = (integer) $jsonString->resultCount;
            $this->results     = json_encode($jsonString->results);

            return $this->results;
        }
    }
public function request ( ) { if ( '' !== $ this -> defaultOptions [ 'callback' ] ) { $ msg = 'Cannot run query when callback is set. Get query using getRawRequestUrl().' ; throw new \ BadMethodCallException ( $ msg ) ; } $ this -> buildSpecificRequestUri ( ) ; try { if ( null === $ content = $ this -> getHttpClient ( ) -> getContent ( $ this -> getRawRequestUrl ( ) ) ) { throw new \ RuntimeException ( 'The request was not successful.' ) ; } } catch ( \ RuntimeException $ e ) { throw new \ RuntimeException ( 'The request was not successful.' ) ; } if ( self :: RESULT_ARRAY === $ this -> resultFormat ) { $ resultSet = json_decode ( $ content , true ) ; $ resultSet = new ResultSet ( $ resultSet [ 'results' ] ) ; return $ resultSet ; } else { // convert JSON-string to array $ jsonString = json_decode ( $ content ) ; $ this -> resultCount = ( integer ) $ jsonString -> resultCount ; $ this -> results = json_encode ( $ jsonString -> results ) ; return $ this -> results ; } }
Query the service and save result

@throws \BadMethodCallException
@throws \RuntimeException

@return ResultSet|string
Query the service and save result