Zend_Controller_Request_HttpTestCase

HTTP request object for use with Zend_Controller family.

uses
package Zend_Controller
subpackage Request
inherited_from \Zend_Controller_Request_Http

 Methods

Constructor

__construct(string|\Zend_Uri $uri = null) : void
Inherited

If a $uri is passed, the object will attempt to populate itself using that information.

Parameters

$uri

string\Zend_Uri

Exceptions

\Zend_Controller_Request_Exception when invalid URI passed

Access values contained in the superglobals as public members Order of precedence: 1. GET, 2. POST, 3. COOKIE, 4. SERVER, 5. ENV

__get(string $key) : mixed
Inherited
see

Parameters

$key

string

Returns

mixed

Check to see if a property is set

__isset(string $key) : boolean
Inherited

Parameters

$key

string

Returns

boolean

Set values

__set(string $key, mixed $value) : void
Inherited

In order to follow __get(), which operates on a number of superglobals, setting values through overloading is not allowed and will raise an exception. Use setParam() instead.

Parameters

$key

string

$value

mixed

Exceptions

\Zend_Controller_Request_Exception

Clear all cookies

clearCookies() : \Zend_Controller_Request_HttpTestCase

Returns

\Zend_Controller_Request_HttpTestCase

Clear request headers

clearHeaders() : \Zend_Controller_Request_HttpTestCase

Returns

\Zend_Controller_Request_HttpTestCase

Unset all user parameters

clearParams() : \Zend_Controller_Request_Abstract
Inherited

Returns

\Zend_Controller_Request_Abstract

Clear POST values

clearPost() : \Zend_Controller_Request_HttpTestCase

Returns

\Zend_Controller_Request_HttpTestCase

Clear GET values

clearQuery() : \Zend_Controller_Request_HttpTestCase

Returns

\Zend_Controller_Request_HttpTestCase

Clear raw POST body

clearRawBody() : \Zend_Controller_Request_HttpTestCase

Returns

\Zend_Controller_Request_HttpTestCase

Alias to __get

get(string $key) : mixed
Inherited

Parameters

$key

string

Returns

mixed

Retrieve the action key

getActionKey() : string
Inherited

Returns

string

Retrieve the action name

getActionName() : string
Inherited

Returns

string

Retrieve an alias

getAlias(string $name) : string | null
Inherited

Retrieve the actual key represented by the alias $name.

Parameters

$name

string

Returns

stringnullReturns null when no alias exists

Retrieve the list of all aliases

getAliases() : array
Inherited

Returns

array

Everything in REQUEST_URI before PATH_INFO not including the filename <img src="<?=$basePath?>/images/zend.png"/>

getBasePath() : string
Inherited

Returns

string

Everything in REQUEST_URI before PATH_INFO <form action="<?=$baseUrl?>/news/submit" method="POST"/>

getBaseUrl($raw = false) : string
Inherited

Parameters

$raw

Returns

string

Get the client's IP addres

getClientIp(boolean $checkProxy = true) : string
Inherited

Parameters

$checkProxy

boolean

Returns

string

Retrieve the controller key

getControllerKey() : string
Inherited

Returns

string

Retrieve the controller name

getControllerName() : string
Inherited

Returns

string

Retrieve a member of the $_COOKIE superglobal

getCookie(string $key = null, mixed $default = null) : mixed
Inherited

If no $key is passed, returns the entire $_COOKIE array.

todo How to retrieve from nested arrays

Parameters

$key

string

$default

mixed

Default value to use if key not found

Returns

mixedReturns null if key does not exist

Retrieve a member of the $_ENV superglobal

getEnv(string $key = null, mixed $default = null) : mixed
Inherited

If no $key is passed, returns the entire $_ENV array.

Parameters

$key

string

$default

mixed

Default value to use if key not found

Returns

mixedReturns null if key does not exist

Get request header

getHeader(string $header, mixed $default = null) : string | null
inherited_from \Zend_Controller_Request_Http::getHeader()

Parameters

$header

string

$default

mixed

Returns

stringnull

Return the value of the given HTTP header. Pass the header name as the plain, HTTP-specified header name. Ex.: Ask for 'Accept' to get the Accept header, 'Accept-Encoding' to get the Accept-Encoding header.

getHeader(string $header) : string | false
Inherited

Parameters

$header

string

HTTP header name

Exceptions

\Zend_Controller_Request_Exception

Returns

stringfalseHTTP header value, or false if not found

Get all request headers

getHeaders() : array

Returns

array

Get the HTTP host.

getHttpHost() : string
Inherited

"Host" ":" host [ ":" port ] ; Section 3.2.2 Note the HTTP Host header is not the same as the URI host. It includes the port while the URI host doesn't.

Returns

string

Get request method

getMethod() : string | null
inherited_from \Zend_Controller_Request_Http::getMethod()

Returns

stringnull

Return the method by which the request was made

getMethod() : string
Inherited

Returns

string

Retrieve the module key

getModuleKey() : string
Inherited

Returns

string

Retrieve the module name

getModuleName() : string
Inherited

Returns

string

Get an action parameter

getParam(string $key, mixed $default = null) : mixed
Inherited

Parameters

$key

string

$default

mixed

Default value to use if key not found

Returns

mixed

Get list of allowed parameter sources

getParamSources() : array
Inherited

Returns

array

Get all action parameters

getParams() : array
Inherited

Returns

array

Returns everything between the BaseUrl and QueryString.

getPathInfo() : string
Inherited

This value is calculated instead of reading PATH_INFO directly from $_SERVER due to cross-platform differences.

Returns

string

Retrieve a member of the $_POST superglobal

getPost(string $key = null, mixed $default = null) : mixed
Inherited

If no $key is passed, returns the entire $_POST array.

todo How to retrieve from nested arrays

Parameters

$key

string

$default

mixed

Default value to use if key not found

Returns

mixedReturns null if key does not exist

Retrieve a member of the $_GET superglobal

getQuery(string $key = null, mixed $default = null) : mixed
Inherited

If no $key is passed, returns the entire $_GET array.

todo How to retrieve from nested arrays

Parameters

$key

string

$default

mixed

Default value to use if key not found

Returns

mixedReturns null if key does not exist

Get RAW POST body

getRawBody() : string | null
inherited_from \Zend_Controller_Request_Http::getRawBody()

Returns

stringnull

Return the raw body of the request, if present

getRawBody() : string | false
Inherited

Returns

stringfalseRaw body, or false if not present

Get REQUEST_URI

getRequestUri() : null | string
inherited_from \Zend_Controller_Request_Http::getRequestUri()

Returns

nullstring

Returns the REQUEST_URI taking into account platform differences between Apache and IIS

getRequestUri() : string
Inherited

Returns

string

Get the request URI scheme

getScheme() : string
Inherited

Returns

string

Retrieve a member of the $_SERVER superglobal

getServer(string $key = null, mixed $default = null) : mixed
Inherited

If no $key is passed, returns the entire $_SERVER array.

Parameters

$key

string

$default

mixed

Default value to use if key not found

Returns

mixedReturns null if key does not exist

Retrieve a single user param (i.e, a param specific to the object and not the environment)

getUserParam(string $key, string $default = null) : mixed
Inherited

Parameters

$key

string

$default

string

Default value to use if key not found

Returns

mixed

Retrieve only user params (i.e, any param specific to the object and not the environment)

getUserParams() : array
Inherited

Returns

array

Alias to __isset()

has(string $key) : boolean
Inherited

Parameters

$key

string

Returns

boolean

Was the request made by DELETE?

isDelete() : boolean
Inherited

Returns

boolean

Determine if the request has been dispatched

isDispatched() : boolean
Inherited

Returns

boolean

Is this a Flash request?

isFlashRequest() : boolean
Inherited

Returns

boolean

Was the request made by GET?

isGet() : boolean
Inherited

Returns

boolean

Was the request made by HEAD?

isHead() : boolean
Inherited

Returns

boolean

Was the request made by OPTIONS?

isOptions() : boolean
Inherited

Returns

boolean

Was the request made by PATCH?

isPatch() : boolean
Inherited

Returns

boolean

Was the request made by POST?

isPost() : boolean
Inherited

Returns

boolean

Was the request made by PUT?

isPut() : boolean
Inherited

Returns

boolean

Is https secure request

isSecure() : boolean
Inherited

Returns

boolean

Is the request a Javascript XMLHttpRequest?

isXmlHttpRequest() : boolean
Inherited

Should work with Prototype/Script.aculo.us, possibly others.

Returns

boolean

Alias to __set()

set(string $key, mixed $value) : void
Inherited

Parameters

$key

string

$value

mixed

Set the action key

setActionKey(string $key) : \Zend_Controller_Request_Abstract
Inherited

Parameters

$key

string

Returns

\Zend_Controller_Request_Abstract

Set the action name

setActionName(string $value) : \Zend_Controller_Request_Abstract
Inherited

Parameters

$value

string

Returns

\Zend_Controller_Request_Abstract

Set a key alias

setAlias(string $name, string $target) : \Zend_Controller_Request_Http
Inherited

Set an alias used for key lookups. $name specifies the alias, $target specifies the actual key to use.

Parameters

$name

string

$target

string

Returns

\Zend_Controller_Request_Http

Set the base path for the URL

setBasePath(string|null $basePath = null) : \Zend_Controller_Request_Http
Inherited

Parameters

$basePath

stringnull

Returns

\Zend_Controller_Request_Http

Set the base URL of the request; i.e., the segment leading to the script name

setBaseUrl(mixed $baseUrl = null) : \Zend_Controller_Request_Http
Inherited

E.g.:

  • /admin
  • /myapp
  • /subdir/index.php

Do not use the full URI when providing the base. The following are examples of what not to use:

If no $baseUrl is provided, attempts to determine the base URL from the environment, using SCRIPT_FILENAME, SCRIPT_NAME, PHP_SELF, and ORIG_SCRIPT_NAME in its determination.

Parameters

$baseUrl

mixed

Returns

\Zend_Controller_Request_Http

Set the controller key

setControllerKey(string $key) : \Zend_Controller_Request_Abstract
Inherited

Parameters

$key

string

Returns

\Zend_Controller_Request_Abstract

Set the controller name to use

setControllerName(string $value) : \Zend_Controller_Request_Abstract
Inherited

Parameters

$value

string

Returns

\Zend_Controller_Request_Abstract

Set a cookie

setCookie(string $key, mixed $value) : \Zend_Controller_Request_HttpTestCase

Parameters

$key

string

$value

mixed

Returns

\Zend_Controller_Request_HttpTestCase

Set multiple cookies at once

setCookies(array $cookies) : void

Parameters

$cookies

array

Set flag indicating whether or not request has been dispatched

setDispatched(boolean $flag = true) : \Zend_Controller_Request_Abstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_Controller_Request_Abstract

Set a request header

setHeader(string $key, string $value) : \Zend_Controller_Request_HttpTestCase

Parameters

$key

string

$value

string

Returns

\Zend_Controller_Request_HttpTestCase

Set request headers

setHeaders(array $headers) : \Zend_Controller_Request_HttpTestCase

Parameters

$headers

array

Returns

\Zend_Controller_Request_HttpTestCase

Set request method

setMethod(string $type) : \Zend_Controller_Request_HttpTestCase

Parameters

$type

string

Returns

\Zend_Controller_Request_HttpTestCase

Set the module key

setModuleKey(string $key) : \Zend_Controller_Request_Abstract
Inherited

Parameters

$key

string

Returns

\Zend_Controller_Request_Abstract

Set the module name to use

setModuleName(string $value) : \Zend_Controller_Request_Abstract
Inherited

Parameters

$value

string

Returns

\Zend_Controller_Request_Abstract

Set an action parameter

setParam(string $key, mixed $value) : \Zend_Controller_Request_Abstract
Inherited

A $value of null will unset the $key if it exists

Parameters

$key

string

$value

mixed

Returns

\Zend_Controller_Request_Abstract

Set allowed parameter sources

setParamSources(array $paramSources = array()) : \Zend_Controller_Request_Http
Inherited

Can be empty array, or contain one or more of '_GET' or '_POST'.

Parameters

$paramSources

Returns

\Zend_Controller_Request_Http

Set action parameters en masse; does not overwrite

setParams(array $array) : \Zend_Controller_Request_Abstract
Inherited

Null values will unset the associated key.

Parameters

$array

array

Returns

\Zend_Controller_Request_Abstract

Set the PATH_INFO string

setPathInfo(string|null $pathInfo = null) : \Zend_Controller_Request_Http
Inherited

Parameters

$pathInfo

stringnull

Returns

\Zend_Controller_Request_Http

Set POST values

setPost(string|array $spec, null|mixed $value = null) : \Zend_Controller_Request_Http
Inherited

Parameters

$spec

stringarray

$value

nullmixed

Returns

\Zend_Controller_Request_Http

Set GET values

setQuery(string|array $spec, null|mixed $value = null) : \Zend_Controller_Request_Http
Inherited

Parameters

$spec

stringarray

$value

nullmixed

Returns

\Zend_Controller_Request_Http

Set raw POST body

setRawBody(string $content) : \Zend_Controller_Request_HttpTestCase

Parameters

$content

string

Returns

\Zend_Controller_Request_HttpTestCase

Set the REQUEST_URI on which the instance operates

setRequestUri(string $requestUri = null) : \Zend_Controller_Request_Http
Inherited

If no request URI is passed, uses the value in $_SERVER['REQUEST_URI'], $_SERVER['HTTP_X_REWRITE_URL'], or $_SERVER['ORIG_PATH_INFO'] + $_SERVER['QUERY_STRING'].

Parameters

$requestUri

string

Returns

\Zend_Controller_Request_Http

Normalize a header name for setting and retrieval

_normalizeHeaderName(string $name) : string

Parameters

$name

string

Returns

string

 Properties

 

Action

$_action : string

Default

 

Action key for retrieving action from params

$_actionKey : string

Default

'action'
 

Alias keys for request parameters

$_aliases : array

Default

array()
 

Base path of request

$_basePath : string

Default

null
 

Base URL of request

$_baseUrl : string

Default

null
 

Controller

$_controller : string

Default

 

Controller key for retrieving controller from params

$_controllerKey : string

Default

'controller'
 

Has the action been dispatched?

$_dispatched : boolean

Default

false
 

Request headers

$_headers : array

Default

array()
 

Request method

$_method : string

Default

'GET'
 

Module

$_module : string

Default

 

Module key for retrieving module from params

$_moduleKey : string

Default

'module'
 

Allowed parameter sources

$_paramSources : array

Default

array('_GET', '_POST')
 

Request parameters

$_params : array

Default

array()
 

PATH_INFO

$_pathInfo : string

Default

''
 

Raw POST body

$_rawBody : string | null

Default

inherited_from \Zend_Controller_Request_Http::_rawBody
 

Raw request body

$_rawBody : string | false

Default

 

REQUEST_URI

$_requestUri : \string;

Default

 

Valid request method types

$_validMethodTypes : array

Default

array('DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT')

 Constants

 

Scheme for http

SCHEME_HTTP = 'http' 
 

Scheme for https

SCHEME_HTTPS = 'https'