Client.php
public function get($resource, $query = array())
    {
        $url = $this->baseUrl . $resource;
        if (count($query) > 0) {
            $url .= "?";
        }

        foreach ($query as $key => $value) {
            $url .= "$key=$value&";
        }

        $headers = array("Authorization" => $this->auth->getCredential());

        try {
            $response = $this->browser->get($url, $headers);
        } catch (\Buzz\Exception\ClientException $e) {
            throw new RequestException($e->getMessage());
        }

        if ($this->browser->getLastResponse()->getStatusCode() > 299) {
            throw new RequestException(json_decode($this->browser->getLastResponse()->getContent(), true));
        }

        return json_decode($response->getContent(), true);
    }
public function get($resource, $query = array())
    {
        $url = $this->baseUrl . $resource;
        if (count($query) > 0) {
            $url .= "?";
        }

        foreach ($query as $key => $value) {
            $url .= "$key=$value&";
        }

        $headers = array("Authorization" => $this->auth->getCredential());

        try {
            $response = $this->browser->get($url, $headers);
        } catch (\Buzz\Exception\ClientException $e) {
            throw new RequestException($e->getMessage());
        }

        if ($this->browser->getLastResponse()->getStatusCode() > 299) {
            throw new RequestException(json_decode($this->browser->getLastResponse()->getContent(), true));
        }

        return json_decode($response->getContent(), true);
    }
public function get ( $ resource , $ query = array ( ) ) { $ url = $ this -> baseUrl . $ resource ; if ( count ( $ query ) > 0 ) { $ url .= "?" ; } foreach ( $ query as $ key => $ value ) { $ url .= "$key=$value&" ; } $ headers = array ( "Authorization" => $ this -> auth -> getCredential ( ) ) ; try { $ response = $ this -> browser -> get ( $ url , $ headers ) ; } catch ( \ Buzz \ Exception \ ClientException $ e ) { throw new RequestException ( $ e -> getMessage ( ) ) ; } if ( $ this -> browser -> getLastResponse ( ) -> getStatusCode ( ) > 299 ) { throw new RequestException ( json_decode ( $ this -> browser -> getLastResponse ( ) -> getContent ( ) , true ) ) ; } return json_decode ( $ response -> getContent ( ) , true ) ; }
Common get request for all API calls

@param string $resource The path to the resource wanted. For example v2/room
@param array $query Parameters to filter the response for example array('max-results' => 50)

@return array Decoded array containing response
@throws Exception\RequestException
Common get request for all API calls