eZPublishCommunityProject(LegacyStack)  2013.9
ezpRestRequest Class Reference

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

+ Inheritance diagram for ezpRestRequest:
+ Collaboration diagram for ezpRestRequest:

Public Member Functions

 __construct ($date=null, $protocol= '', $host= '', $uri= '', $requestId= '', $referrer= '', $variables=array(), $get=array(), $post=array(), $contentVariables=array(), $isEncrypted=false, $body= '', $files=null, $accept=null, $agent=null, $authentication=null, $raw=null, $cookies=array(), $isFatal=false, $originalProtocol=null)
 Constructs a new ezpRestRequest. More...
 
 getBaseURI ()
 Returns base URI with protocol and host (e.g. More...
 
 getContentQueryString ($withQuestionMark=false)
 Returns current content variables as a regular query string (e.g. More...
 
 getHostURI ()
 Returns the host with the protocol. More...
 
 getParsedBody ()
 Get parsed request body based on content type as a php hash. More...
 

Static Public Member Functions

static __set_state (array $array)
 Returns a new instance of this class with the data specified by $array. More...
 

Public Attributes

 $contentVariables
 
 $get
 
 $isEncrypted
 
 $originalProtocol
 
 $post
 

Detailed Description

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.

Constructor & Destructor Documentation

ezpRestRequest::__construct (   $date = null,
  $protocol = '',
  $host = '',
  $uri = '',
  $requestId = '',
  $referrer = '',
  $variables = array(),
  $get = array(),
  $post = array(),
  $contentVariables = array(),
  $isEncrypted = false,
  $body = '',
  $files = null,
  $accept = null,
  $agent = null,
  $authentication = null,
  $raw = null,
  $cookies = array(),
  $isFatal = false,
  $originalProtocol = null 
)

Constructs a new ezpRestRequest.

Parameters
DateTime$date
string$protocol
string$host
string$uri
string$requestId
string$referrer
array$variablesContaining request variables set by the router
array$getThe GET variables which are available in the request
array$postThe POST variables that are available in the request
array$contentVariablesGET variables related to eZ Publish content
bool$isEncryptedIs 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$originalProtocolUses $protocol if null
Returns
ezpRestRequest

Member Function Documentation

static ezpRestRequest::__set_state ( array  $array)
static

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.

Parameters
array(string=>mixed)$array
Returns
ezpRestRequest
ezpRestRequest::getBaseURI ( )

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

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

Returns
string
ezpRestRequest::getContentQueryString (   $withQuestionMark = false)

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

"foo=bar&this=that")

Parameters
bool$withQuestionMarkIf true, the question mark ("?") will be added
Returns
string
ezpRestRequest::getHostURI ( )

Returns the host with the protocol.

Returns
string

Referenced by getBaseURI().

ezpRestRequest::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.

Todo:
Add some sort of configurable lazy loaded request body handler for parsing misc content type.
Returns
array|null Null on unsupported content type.

Member Data Documentation

ezpRestRequest::$contentVariables

Referenced by __construct().

ezpRestRequest::$get

Referenced by __construct().

ezpRestRequest::$isEncrypted

Referenced by __construct().

ezpRestRequest::$originalProtocol

Referenced by __construct().

ezpRestRequest::$post

Referenced by __construct(), and getParsedBody().


The documentation for this class was generated from the following file: