Pantheon\Terminus\Request\Request::request PHP Метод

request() публичный Метод

Simplified request method for Pantheon API
public request ( string $path, array $arg_options = [] ) : array
$path string API path (URL)
$arg_options array Options for the request [string] method GET is default [mixed] data Native PHP data structure (e.g. int, string array, or simple object) to be sent along with the request. Will be encoded as JSON for you. [boolean] absolute_url True if URL passed is to be treated as absolute
Результат array
    public function request($path, $arg_options = [])
    {
        $default_options = ['method' => 'get', 'absolute_url' => false];
        $options = array_merge($default_options, $arg_options);
        $url = $path;
        if (strpos($path, 'http') !== 0 && !$options['absolute_url']) {
            $url = sprintf('%s://%s:%s/api/%s', $this->getConfig()->get('protocol'), $this->getConfig()->get('host'), $this->getConfig()->get('port'), $path);
        }
        $response = $this->send($url, $options['method'], $options);
        $data = ['data' => json_decode($response->getBody()->getContents()), 'headers' => $response->getHeaders(), 'status_code' => $response->getStatusCode()];
        return $data;
    }