Свойство | Тип | Описание | |
---|---|---|---|
$connection | lithium\net\Socket | The Socket instance used to send Service calls. | |
$last | object | Holds the last request and response object |
Свойство | Тип | Описание | |
---|---|---|---|
$_autoConfig | array | Auto config | |
$_classes | array | Fully-name-spaced class references to Service class dependencies. | |
$_isConnected | boolean | Defaults to true until a connection attempt fails. | |
$_responseTypes | array | Array of closures that return various pieces of information about an HTTP response. |
Метод | Описание | |
---|---|---|
__call ( string $method, string $params = [] ) : mixed | Magic method to handle other HTTP methods. | |
__construct ( array $config = [] ) : void | Constructor. Initializes a new Service instance with the default HTTP request settings and transport- and format-handling classes. | |
delete ( string $path = null, array $data = [], array $options = [] ) : string | Send DELETE request. | |
get ( string $path = null, array $data = [], array $options = [] ) : string | Send GET request. | |
head ( string $path = null, array $data = [], array $options = [] ) : string | Send HEAD request. | |
patch ( string $path = null, array $data = [], array $options = [] ) : string | Send PATCH request. | |
post ( string $path = null, array $data = [], array $options = [] ) : string | Send POST request. | |
put ( string $path = null, array $data = [], array $options = [] ) : string | Send PUT request. | |
respondsTo ( string $method, boolean $internal = false ) : boolean | Determines if a given method can be called. | |
send ( string $method, string $path = null, array $data = [], array $options = [] ) : string | Send request and return response data. Will open the connection if needed and always close it after sending the request. |
Метод | Описание | |
---|---|---|
_init ( ) : void | Initialize connection. | |
_request ( string $method, string $path, string $data, string $options ) : object | Instantiates a request object (usually an instance of http\Request) and tests its properties based on the request type and data to be sent. |
public __construct ( array $config = [] ) : void | ||
$config | array | Available configuration options are: - `'persistent'` _boolean_ - `'scheme'` _string_ - `'host'` _string_ - `'port'` _integer_ - `'timeout'` _integer_ - `'auth'` _boolean_ - `'username'` _string_ - `'password'` _string_ - `'encoding'` _string_ - `'socket'` _string_ |
Результат | void |
protected _request ( string $method, string $path, string $data, string $options ) : object | ||
$method | string | The HTTP method of the request, i.e. `'GET'`, `'HEAD'`, `'OPTIONS'`, etc. Can be passed in upper- or lower-case. |
$path | string | The |
$data | string | |
$options | string | |
Результат | object | Returns an instance of `http\Request`, configured with an HTTP method, query string or POST/PUT/PATCH data, and URL. |
public respondsTo ( string $method, boolean $internal = false ) : boolean | ||
$method | string | Name of the method. |
$internal | boolean | Provide `true` to perform check from inside the class/object. When `false` checks also for public visibility; defaults to `false`. |
Результат | boolean | Returns `true` if the method can be called, `false` otherwise. |
public send ( string $method, string $path = null, array $data = [], array $options = [] ) : string | ||
$method | string | |
$path | string | |
$data | array | the parameters for the request. For GET/DELETE this is the query string for POST/PUT this is the body |
$options | array | passed to request and socket |
Результат | string |
protected array $_classes | ||
Результат | array |
protected bool $_isConnected | ||
Результат | boolean |
protected array $_responseTypes | ||
Результат | array |
public lithium\net\Socket $connection | ||
Результат | lithium\net\Socket |
public object $last | ||
Результат | object |