PHP Класс Pantheon\Terminus\Request\Request

Handles requests made by Terminus This is simply a class to manage the interactions between Terminus and Guzzle (the HTTP library Terminus uses). This class should eventually evolve to manage all requests to external resources such. Eventually we could even log requests in debug mode.
Наследование: implements Robo\Contract\ConfigAwareInterface, implements Pantheon\Terminus\Session\SessionAwareInterface, implements Psr\Log\LoggerAwareInterface, use trait Psr\Log\LoggerAwareTrait, use trait Robo\Common\ConfigAwareTrait, use trait Pantheon\Terminus\Session\SessionAwareTrait
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
download ( string $url, string $target ) : boolean Download file from target URL
pagedRequest ( string $path, array $options = [] ) : array Make a request to the Dashbord's internal API
request ( string $path, array $arg_options = [] ) : array Simplified request method for Pantheon API

Приватные методы

Метод Описание
fillCookieJar ( array $params ) : GuzzleHttp\Cookie\CookieJar Sets up and fills a cookie jar
getBaseUri ( ) : string Parses the base URI for requests
send ( string $uri, string $method, array $arg_params = [] ) : Psr\Http\Message\ResponseInterface Sends a request to the API
userAgent ( ) : string Gives the user-agent string

Описание методов

download() публичный статический Метод

Download file from target URL
public static download ( string $url, string $target ) : boolean
$url string URL to download from
$target string Target file's name
Результат boolean True if download succeeded

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

Make a request to the Dashbord's internal API
public pagedRequest ( string $path, array $options = [] ) : array
$path string API path (URL)
$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.
Результат array

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