kernel/private/rest/classes/request/rest_request.php
File containing the ezpRestRequest class
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Package
- rest
- Version
- 4.6.0
\ezpRestRequest
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.
- Parent(s)
- \ezcMvcRequest
Properties


bool
$isEncrypted= ''
Signifies whether the request was made over an encrypted connection.
- Type
- bool
Methods


__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
)
:
\ezpRestRequest
Constructs a new ezpRestRequest.
Name | Type | Description |
---|---|---|
$date | \DateTime | |
$protocol | string | |
$host | string | |
$uri | string | |
$requestId | string | |
$referrer | string | |
$variables | array | Containing request variables set by the router |
$get | array | The GET variables which are available in the request |
$post | array | The POST variables that are available in the request |
$contentVariables | array | GET variables related to eZ Publish content |
$isEncrypted | bool | Is the request made over an encrypted connection |
$body | string | |
$files | \array(ezcMvcRequestFile) | |
$accept | \ezcMvcRequestAccept | |
$agent | \ezcMvcRequestUserAgent | |
$authentication | \ezcMvcRequestAuthentication | |
$raw | \ezcMvcRawRequest | |
$cookies | \array(ezcMvcRequestCookie) | |
$isFatal | bool | |
$originalProtocol | string | null | Uses $protocol if null |
Type | Description |
---|---|
\ezpRestRequest |


__set_state(
\array(string=>mixed) $array
)
:
\ezpRestRequest
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).
__set_state makes this class exportable with var_export. var_export() generates code, that calls this method when it is parsed with PHP.
Name | Type | Description |
---|---|---|
$array | \array(string=>mixed) |
Type | Description |
---|---|
\ezpRestRequest |


getBaseURI(
)
:
string
Returns base URI with protocol and host (e.g. http://myhost.com/foo/bar)
Type | Description |
---|---|
string |


getContentQueryString(
bool $withQuestionMark
=
false
)
:
string
Returns current content variables as a regular query string (e.g. "foo=bar&this=that")
Name | Type | Description |
---|---|---|
$withQuestionMark | bool | If true, the question mark ("?") will be added |
Type | Description |
---|---|
string |


getParsedBody(
)
:
array | null
Get parsed request body based on content type as a php hash.
In PUT / DELETE currently only supports application/x-www-form-urlencoded and application/json, for anything else use ->body atm. If POST then ->post is returned.
Type | Description |
---|---|
array | null | Null on unsupported protocol or content type. |
- Todo
- Add some sort of configurable lazy loaded request body handler for parsing misc content type.