Request
in package

This is the Request class.

The requests to make petitions by HTTP(s) will be prepared throught that class.

Tags
see
Request::getPath()
see
Request::setPath()
see
Request::getMethod()
see
Request::setMethod()
see
Request::getPathParams()
see
Request::setPathParams()
see
Request::getUrlParams()
see
Request::setUrlParams()
see
Request::getFormParams()
see
Request::setFormParams()
see
Request::getBody()
see
Request::setBody()
see
Request::getHeaders()
see
Request::setHeaders()

Table of Contents

$body  : array<string|int, mixed>
$formParams  : array<string|int, mixed>
$headers  : array<string|int, mixed>
$method  : string
$path  : string
$pathParams  : array<string|int, mixed>
$urlParams  : array<string|int, mixed>
getBody() Returns the request body.  : array<string|int, mixed>
getFormParams() Returns the request form parameters.  : array<string|int, mixed>
getFullPath() Returns the request path with the pathParams replaced.  : string
getHeaders() Returns the request headers.  : array<string|int, mixed>
getMethod() Returns the request method.  : string
getPath() Returns the request path.  : string
getPathParams() Returns the request path parameters.  : array<string|int, mixed>
getUrlParams() Returns the request URL parameters.  : array<string|int, mixed>
setBody() Sets the request body.  : void
setFormParams() Sets the request form (the ones sent by POST) parameters.  : void
setHeaders() Sets the request headers.  : void
setMethod() Sets the request method.  : void
setPath() Sets the request path.  : void
setPathParams() Sets the request path parameters.  : void
setUrlParams() Sets the request URL (the ones sent by GET) parameters.  : void
toArray()  : array<string|int, mixed>

Properties

$body

protected array<string|int, mixed> $body = []

$formParams

protected array<string|int, mixed> $formParams = []

$headers

protected array<string|int, mixed> $headers = []

$method

protected string $method = \SDK\Core\Enums\MethodType::GET

$pathParams

protected array<string|int, mixed> $pathParams = []

$urlParams

protected array<string|int, mixed> $urlParams = []

Methods

getBody()

Returns the request body.

public getBody() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getFormParams()

Returns the request form parameters.

public getFormParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getFullPath()

Returns the request path with the pathParams replaced.

public getFullPath() : string
Return values
string —

getHeaders()

Returns the request headers.

public getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getMethod()

Returns the request method.

public getMethod() : string
Return values
string —

getPath()

Returns the request path.

public getPath() : string
Return values
string —

getPathParams()

Returns the request path parameters.

public getPathParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getUrlParams()

Returns the request URL parameters.

public getUrlParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —

setBody()

Sets the request body.

public setBody(mixed $body) : void
Parameters
$body : mixed

An instance of ParametersGroup or an array. Something else will throw an exception.

Tags
throws
RequestException
Return values
void —

setFormParams()

Sets the request form (the ones sent by POST) parameters.

public setFormParams(mixed $formParams) : void
Parameters
$formParams : mixed

An instance of ParametersGroup or an array. Something else will throw an exception.

Tags
throws
RequestException
Return values
void —

setHeaders()

Sets the request headers.

public setHeaders(array<string|int, mixed> $headers) : void
Parameters
$headers : array<string|int, mixed>
Return values
void —

setMethod()

Sets the request method.

public setMethod(string $method) : void
Parameters
$method : string

Must be a valid method (given in the MethodType enumerate)

Tags
throws
RequestException
Return values
void —

setPath()

Sets the request path.

public setPath(string $path) : void
Parameters
$path : string
Return values
void —

setPathParams()

Sets the request path parameters.

public setPathParams(mixed $pathParams) : void
Parameters
$pathParams : mixed

An instance of ParametersGroup or an array. Something else will throw an exception.

Tags
throws
RequestException
Return values
void —

setUrlParams()

Sets the request URL (the ones sent by GET) parameters.

public setUrlParams(mixed $urlParams) : void
Parameters
$urlParams : mixed

An instance of ParametersGroup or an array. Something else will throw an exception.

Tags
throws
RequestException
Return values
void —

toArray()

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —

Search results