PHP 클래스 lithium\net\http\Service

상속: extends lithium\core\Object
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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.

메소드 상세

__call() 공개 메소드

Magic method to handle other HTTP methods.
public __call ( string $method, string $params = [] ) : mixed
$method string
$params string
리턴 mixed

__construct() 공개 메소드

Constructor. Initializes a new Service instance with the default HTTP request settings and transport- and format-handling classes.
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

_init() 보호된 메소드

Initialize connection.
protected _init ( ) : void
리턴 void

_request() 보호된 메소드

Instantiates a request object (usually an instance of http\Request) and tests its properties based on the request type and data to be sent.
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.

delete() 공개 메소드

Send DELETE request.
public delete ( string $path = null, array $data = [], array $options = [] ) : string
$path string
$data array
$options array
리턴 string

get() 공개 메소드

Send GET request.
public get ( string $path = null, array $data = [], array $options = [] ) : string
$path string
$data array
$options array
리턴 string

head() 공개 메소드

Send HEAD request.
public head ( string $path = null, array $data = [], array $options = [] ) : string
$path string
$data array
$options array
리턴 string

patch() 공개 메소드

Send PATCH request.
public patch ( string $path = null, array $data = [], array $options = [] ) : string
$path string
$data array
$options array
리턴 string

post() 공개 메소드

Send POST request.
public post ( string $path = null, array $data = [], array $options = [] ) : string
$path string
$data array
$options array
리턴 string

put() 공개 메소드

Send PUT request.
public put ( string $path = null, array $data = [], array $options = [] ) : string
$path string
$data array
$options array
리턴 string

respondsTo() 공개 메소드

Determines if a given method can be called.
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.

send() 공개 메소드

Will automatically authenticate when receiving a 401 HTTP status code then continue retrying sending initial request.
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

프로퍼티 상세

$_autoConfig 보호되어 있는 프로퍼티

Auto config
protected array $_autoConfig
리턴 array

$_classes 보호되어 있는 프로퍼티

Fully-name-spaced class references to Service class dependencies.
protected array $_classes
리턴 array

$_isConnected 보호되어 있는 프로퍼티

Defaults to true until a connection attempt fails.
protected bool $_isConnected
리턴 boolean

$_responseTypes 보호되어 있는 프로퍼티

Array of closures that return various pieces of information about an HTTP response.
protected array $_responseTypes
리턴 array

$connection 공개적으로 프로퍼티

The Socket instance used to send Service calls.
public lithium\net\Socket $connection
리턴 lithium\net\Socket

$last 공개적으로 프로퍼티

Holds the last request and response object
public object $last
리턴 object