kernel/private/rest/classes/request/rest_request.php

Show: inherited
Table of Contents

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

Package: Default

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

Propertypublicarray  $contentVariables= ''

Variables related to content, extracted from GET

Details
Type
array
Propertypublicarray  $get= ''

GET variables

Details
Type
array
Propertypublicbool  $isEncrypted= ''

Signifies whether the request was made over an encrypted connection.

Details
Type
bool
Propertypublicstring  $originalProtocol= ''

Original request method

Details
Type
string
Propertypublicarray  $post= ''

POST variables

Details
Type
array

Methods

methodpublic__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.

Parameters
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

Returns
Type Description
\ezpRestRequest
methodpublic__set_state( \array(string=>mixed) $array ) : \ezpRestRequest
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
Name Type Description
$array \array(string=>mixed)
Returns
Type Description
\ezpRestRequest
methodpublicgetBaseURI( ) : string

Returns base URI with protocol and host (e.g. http://myhost.com/foo/bar)

Returns
Type Description
string
methodpublicgetContentQueryString( bool $withQuestionMark = false ) : string

Returns current content variables as a regular query string (e.g. "foo=bar&this=that")

Parameters
Name Type Description
$withQuestionMark bool

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

Returns
Type Description
string
methodpublicgetHostURI( ) : string

Returns the host with the protocol

Returns
Type Description
string
methodpublicgetParsedBody( ) : 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.

Returns
Type Description
array | null Null on unsupported protocol or content type.
Details
Todo
Add some sort of configurable lazy loaded request body handler for parsing misc content type.  
Documentation was generated by DocBlox 0.18.1.