Dwolla\RestClient::_get PHP Метод

_get() защищенный Метод

Wrapper around Guzzle GET request.
protected _get ( string $endpoint, string[] $query, boolean $customPostfix = false, boolean $dwollaParse = true ) : string[]
$endpoint string API endpoint string
$query string[] Array of URLEncoded query items in key-value pairs.
$customPostfix boolean Use default REST postfix?
$dwollaParse boolean Parse out of message envelope?
Результат string[] Response body.
    protected function _get($endpoint, $query, $customPostfix = false, $dwollaParse = true)
    {
        // First, we try to catch any errors as the request "goes out the door"
        try {
            $response = $this->client->get($this->_host() . ($customPostfix ? $customPostfix : self::$settings->default_postfix) . $endpoint, ['query' => $query]);
            if (self::$settings->debug) {
                $this->_console("GET Request to {$endpoint}\n");
                $this->_console("    " . json_encode($query));
            }
        } catch (RequestException $exception) {
            $response = false;
            if (self::$settings->debug) {
                $this->_console("DwollaPHP: An error has occurred during a GET request.\nRequest Body:\n");
                $this->_console($exception->getRequest());
                if ($exception->hasResponse()) {
                    $this->_console("Server Response:\n");
                    $this->_console($exception->getResponse());
                }
            }
        }
        if ($response) {
            if ($response->getBody()) {
                // If we get a response, we parse it out of the Dwolla envelope and catch API errors.
                return $dwollaParse ? $this->_dwollaparse(json_decode($response->getBody(), true)) : json_decode($response->getBody(), true);
            }
        } else {
            if (self::$settings->debug) {
                $this->_console("DwollaPHP: An error has occurred; the response body is empty");
            }
            return null;
        }
    }