eZ Publish Community Project (Legacy Stack) 2013.4
Class

ezpRestRequest

class ezpRestRequest extends ezcMvcRequest

Class mimicking ezcMvcRequest with distinct containers for GET and POST variables.

The current implementation is a tentative implementation, for long term usage, we are likely to use dedicated structs such as for cookie. This in addition or alternatively to a more selective parser, which could cherry pick variables depending on request type, context and so forth.

Properties

array $get GET variables
array $post POST variables
string $originalProtocol Original request method
array $contentVariables Variables related to content, extracted from GET
bool $isEncrypted Signifies whether the request was made over an encrypted connection.

Methods

ezpRestRequest __construct(DateTime $date = null, string $protocol = '', string $host = '', string $uri = '', string $requestId = '', string $referrer = '', array $variables = array(), array $get = array(), array $post = array(), array $contentVariables = array(), bool $isEncrypted = false, string $body = '', array(ezcMvcRequestFile) $files = null, ezcMvcRequestAccept $accept = null, ezcMvcRequestUserAgent $agent = null, ezcMvcRequestAuthentication $authentication = null, ezcMvcRawRequest $raw = null, array(ezcMvcRequestCookie) $cookies = array(), bool $isFatal = false, string|null $originalProtocol = null)

Constructs a new ezpRestRequest.

static ezpRestRequest __set_state(array $array)

Returns a new instance of this class with the data specified by $array.

string getBaseURI()

Returns base URI with protocol and host (e.g.

string getHostURI()

Returns the host with the protocol

string getContentQueryString(bool $withQuestionMark = false)

Returns current content variables as a regular query string (e.g.

array|null getParsedBody()

Get parsed request body based on content type as a php hash.

Details

at line 82
public ezpRestRequest __construct(DateTime $date = null, string $protocol = '', string $host = '', string $uri = '', string $requestId = '', string $referrer = '', array $variables = array(), array $get = array(), array $post = array(), array $contentVariables = array(), bool $isEncrypted = false, string $body = '', array(ezcMvcRequestFile) $files = null, ezcMvcRequestAccept $accept = null, ezcMvcRequestUserAgent $agent = null, ezcMvcRequestAuthentication $authentication = null, ezcMvcRawRequest $raw = null, array(ezcMvcRequestCookie) $cookies = array(), bool $isFatal = false, string|null $originalProtocol = null)

Constructs a new ezpRestRequest.

Parameters

DateTime $date
string $protocol
string $host
string $uri
string $requestId
string $referrer
array $variables Containing request variables set by the router
array $get The GET variables which are available in the request
array $post The POST variables that are available in the request
array $contentVariables GET variables related to eZ Publish content
bool $isEncrypted Is the request made over an encrypted connection
string $body
array(ezcMvcRequestFile) $files
ezcMvcRequestAccept $accept
ezcMvcRequestUserAgent $agent
ezcMvcRequestAuthentication $authentication
ezcMvcRawRequest $raw
array(ezcMvcRequestCookie) $cookies
bool $isFatal
string|null $originalProtocol Uses $protocol if null

Return Value

ezpRestRequest

at line 123
static public ezpRestRequest __set_state(array $array)

Returns a new instance of this class with the data specified by $array.

$array contains all the data members of this class in the form: array('member_name'=>value).

__setstate makes this class exportable with varexport. var_export() generates code, that calls this method when it is parsed with PHP.

Parameters

array $array

Return Value

ezpRestRequest

at line 139
public string getBaseURI()

Returns base URI with protocol and host (e.g.

http://myhost.com/foo/bar)

Return Value

string

at line 155
public string getHostURI()

Returns the host with the protocol

Return Value

string

at line 170
public string getContentQueryString(bool $withQuestionMark = false)

Returns current content variables as a regular query string (e.g.

"foo=bar&this=that")

Parameters

bool $withQuestionMark If true, the question mark ("?") will be added

Return Value

string

at line 197
public array|null getParsedBody()

Get parsed request body based on content type as a php hash.

Only supports application/x-www-form-urlencoded and application/json, for anything else use ->body atm. If POST then ->post is returned.

Return Value

array|null Null on unsupported content type.