Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ezpRestRequest Class Reference
Inheritance 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)
| getBaseURI ()
| getHostURI ()
| getContentQueryString ( $withQuestionMark=false)
| getParsedBody ()

## Static Public Member Functions
static | __set_state (array $array)

## Public Attributes
| $get
| $post
| $originalProtocol
| $contentVariables
| $isEncrypted

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

Definition at line 20 of file rest_request.php.

## Constructor & Destructor Documentation

## ◆ __construct()

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 | $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 Exponential 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

Returns
  ezpRestRequest

Definition at line 83 of file rest_request.php.

References $contentVariables, $date, $files, $get, $isEncrypted, $originalProtocol, $post, and $uri.

## Member Function Documentation

## ◆ __set_state()

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

Definition at line 124 of file rest_request.php.

## ◆ getBaseURI()

ezpRestRequest::getBaseURI | ( |  | ) |

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

Returns
  string

Definition at line 140 of file rest_request.php.

References $uri, ezpRestPrefixFilterInterface\getApiProviderName(), and getHostURI().

## ◆ getContentQueryString()

ezpRestRequest::getContentQueryString | ( |  | $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

Returns
  string

Definition at line 171 of file rest_request.php.

References $name.

## ◆ getHostURI()

ezpRestRequest::getHostURI | ( |  | ) |

Returns the host with the protocol

Returns
  string

Definition at line 156 of file rest_request.php.

Referenced by getBaseURI().

## ◆ getParsedBody()

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.

Definition at line 198 of file rest_request.php.

References $post.

## Member Data Documentation

## ◆ $contentVariables

ezpRestRequest::$contentVariables

Definition at line 48 of file rest_request.php.

Referenced by __construct().

## ◆ $get

ezpRestRequest::$get

Definition at line 27 of file rest_request.php.

Referenced by __construct().

## ◆ $isEncrypted

ezpRestRequest::$isEncrypted

Definition at line 55 of file rest_request.php.

Referenced by __construct().

## ◆ $originalProtocol

ezpRestRequest::$originalProtocol

Definition at line 41 of file rest_request.php.

Referenced by __construct().

## ◆ $post

ezpRestRequest::$post

Definition at line 34 of file rest_request.php.

Referenced by __construct(), and getParsedBody().

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

- rest_request.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.