category Zend
package Zend_Controller
subpackage Dispatcher
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Controller_Dispatcher_Abstract

 Methods

Constructor: Set current module to default value

__construct(array $params = array()) : void
inherited_from \Zend_Controller_Dispatcher_Abstract::__construct()

Parameters

$params

array

Constructor

__construct(array $params = array()) : void
Inherited

Parameters

$params

Verify delimiter

_verifyDelimiter(string|array $spec) : array
Inherited

Verify a delimiter to use in controllers or actions. May be a single string or an array of strings.

Parameters

$spec

stringarray

Exceptions

\Zend_Controller_Dispatcher_Exception with invalid delimiters

Returns

array

Add a single path to the controller directory stack

addControllerDirectory(string $path, string $module = null) : \Zend_Controller_Dispatcher_Standard

Parameters

$path

string

$module

string

Returns

\Zend_Controller_Dispatcher_Standard

Convert a class name to a filename

classToFilename(string $class) : string

Parameters

$class

string

Returns

string

Clear the controller parameter stack

clearParams($name = null) : \Zend_Controller_Dispatcher_Abstract
Inherited

By default, clears all parameters. If a parameter name is given, clears only that parameter; if an array of parameter names is provided, clears each.

inherited_from \Zend_Controller_Dispatcher_Interface::clearParams()

Parameters

$name

Returns

\Zend_Controller_Dispatcher_Abstract

Dispatch to a controller/action

dispatch(\Zend_Controller_Request_Abstract $request, \Zend_Controller_Response_Abstract $response) : void

By default, if a controller is not dispatchable, dispatch() will throw an exception. If you wish to use the default controller instead, set the param 'useDefaultControllerAlways' via \setParam().

Parameters

$request

\Zend_Controller_Request_Abstract

$response

\Zend_Controller_Response_Abstract

Exceptions

\Zend_Controller_Dispatcher_Exception

Formats a string into an action name. This is used to take a raw action name, such as one that would be stored inside a Zend_Controller_Request_Abstract object, and reformat into a proper method name that would be found inside a class extending Zend_Controller_Action.

formatActionName(string $unformatted) : string
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::formatActionName()

Parameters

$unformatted

string

Returns

string

Format action class name

formatClassName(string $moduleName, string $className) : string

Parameters

$moduleName

string

Name of the current module

$className

string

Name of the action class

Returns

stringFormatted class name

Formats a string into a controller name. This is used to take a raw controller name, such as one stored inside a Zend_Controller_Request_Abstract object, and reformat it to a proper class name that a class extending Zend_Controller_Action would use.

formatControllerName(string $unformatted) : string
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::formatControllerName()

Parameters

$unformatted

string

Returns

string

Format the module name.

formatModuleName(string $unformatted) : string

Parameters

$unformatted

string

Returns

string

Determine the action name

getActionMethod(\Zend_Controller_Request_Abstract $request) : string

First attempt to retrieve from request; then from request params using action key; default to default action

Returns formatted action name

Parameters

$request

\Zend_Controller_Request_Abstract

Returns

string

Get controller class name

getControllerClass(\Zend_Controller_Request_Abstract $request) : string | false

Try request first; if not found, try pulling from request parameter; if still not found, fallback to default

Parameters

$request

\Zend_Controller_Request_Abstract

Returns

stringfalseReturns class name on success

Return the currently set directories for Zend_Controller_Action class lookup

getControllerDirectory(string $module = null) : array | string

If a module is specified, returns just that directory.

Parameters

$module

string

Module name

Returns

arraystringReturns array of all directories by default, single module directory if module argument provided

Retrieve the default action name (minus formatting)

getDefaultAction() : string
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::getDefaultAction()

Returns

string

Retrieve default controller class

getDefaultControllerClass(\Zend_Controller_Request_Abstract $request) : string

Determines whether the default controller to use lies within the requested module, or if the global default should be used.

By default, will only use the module default unless that controller does not exist; if this is the case, it falls back to the default controller in the default module.

Parameters

$request

\Zend_Controller_Request_Abstract

Returns

string

Retrieve the default controller name (minus formatting)

getDefaultControllerName() : string
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::getDefaultControllerName()

Returns

string

Retrieve the default module

getDefaultModule() : string
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::getDefaultModule()

Returns

string

Return the value of the currently selected dispatch directory (as set by {@link getController()})

getDispatchDirectory() : string

Returns

string

Retrieve front controller instance

getFrontController() : \Zend_Controller_Front
Inherited

Returns

\Zend_Controller_Front

Retrieve a single parameter from the controller parameter stack

getParam(string $name) : mixed
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::getParam()

Parameters

$name

string

Returns

mixed

Retrieve action controller instantiation parameters

getParams() : array
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::getParams()

Returns

array

Retrieve the path delimiter character(s) used in controller names

getPathDelimiter() : array
Inherited

Returns

array

Return the registered response object

getResponse() : \Zend_Controller_Response_Abstract | null
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::getResponse()

Returns

\Zend_Controller_Response_Abstractnull

Retrieve the word delimiter character(s) used in controller or action names

getWordDelimiter() : array
Inherited

Returns

array

Returns TRUE if the Zend_Controller_Request_Abstract object can be dispatched to a controller.

isDispatchable(\Zend_Controller_Request_Abstract $request) : boolean

Use this method wisely. By default, the dispatcher will fall back to the default controller (either in the module specified or the global default) if a given controller does not exist. This method returning false does not necessarily indicate the dispatcher will not still dispatch the call.

Parameters

$request

Returns

boolean

Determine if a given module is valid

isValidModule(string $module) : boolean

Parameters

$module

string

Returns

boolean

Load a controller class

loadClass(string $className) : string

Attempts to load the controller class file from \getControllerDirectory(). If the controller belongs to a module, looks for the module prefix to the controller class.

Parameters

$className

string

Exceptions

\Zend_Controller_Dispatcher_Exception if class not loaded

Returns

stringClass name loaded

Remove a controller directory by module name

removeControllerDirectory(string $module) : boolean

Parameters

$module

string

Returns

boolean

Set controller directory

setControllerDirectory(array|string $directory, $module = null) : \Zend_Controller_Dispatcher_Standard

Parameters

$directory

arraystring

$module

Returns

\Zend_Controller_Dispatcher_Standard

Set the default action (minus any formatting)

setDefaultAction(string $action) : \Zend_Controller_Dispatcher_Abstract
Inherited

Parameters

$action

string

Returns

\Zend_Controller_Dispatcher_Abstract

Set the default controller (minus any formatting)

setDefaultControllerName(string $controller) : \Zend_Controller_Dispatcher_Abstract
Inherited

Parameters

$controller

string

Returns

\Zend_Controller_Dispatcher_Abstract

Set the default module

setDefaultModule(string $module) : \Zend_Controller_Dispatcher_Abstract
Inherited

Parameters

$module

string

Returns

\Zend_Controller_Dispatcher_Abstract

Set front controller instance

setFrontController(\Zend_Controller_Front $controller) : \Zend_Controller_Dispatcher_Abstract
Inherited

Parameters

$controller

\Zend_Controller_Front

Returns

\Zend_Controller_Dispatcher_Abstract

Add or modify a parameter to use when instantiating an action controller

setParam(string $name, mixed $value) : \Zend_Controller_Dispatcher_Abstract
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::setParam()

Parameters

$name

string

$value

mixed

Returns

\Zend_Controller_Dispatcher_Abstract

Set parameters to pass to action controller constructors

setParams(array $params) : \Zend_Controller_Dispatcher_Abstract
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::setParams()

Parameters

$params

array

Returns

\Zend_Controller_Dispatcher_Abstract

Set path delimiter

setPathDelimiter(string $spec) : \Zend_Controller_Dispatcher_Abstract
Inherited

Set the path delimiter to use in controllers. May be a single string or an array of strings.

Parameters

$spec

string

Returns

\Zend_Controller_Dispatcher_Abstract

Set response object to pass to action controllers

setResponse(\Zend_Controller_Response_Abstract|null $response = null) : \Zend_Controller_Dispatcher_Abstract
Inherited
inherited_from \Zend_Controller_Dispatcher_Interface::setResponse()

Parameters

$response

\Zend_Controller_Response_Abstractnull

Returns

\Zend_Controller_Dispatcher_Abstract

Set word delimiter

setWordDelimiter(string|array $spec) : \Zend_Controller_Dispatcher_Abstract
Inherited

Set the word delimiter to use in controllers and actions. May be a single string or an array of strings.

Parameters

$spec

stringarray

Returns

\Zend_Controller_Dispatcher_Abstract

Formats a string from a URI into a PHP-friendly name.

_formatName(string $unformatted, boolean $isAction = false) : string
Inherited

By default, replaces words separated by the word separator character(s) with camelCaps. If $isAction is false, it also preserves replaces words separated by the path separation character with an underscore, making the following word Title cased. All non-alphanumeric characters are removed.

Parameters

$unformatted

string

$isAction

boolean

Defaults to false

Returns

string

 Properties

 

Controller directory(ies)

$_controllerDirectory : array

Default

array()
 

Current dispatchable directory

$_curDirectory : string

Default

 

Current module (formatted)

$_curModule : string

Default

 

Default action

$_defaultAction : string

Default

'index'
 

Default controller

$_defaultController : string

Default

'index'
 

Default module

$_defaultModule : string

Default

'default'
 

Front Controller instance

$_frontController : \Zend_Controller_Front

Default

 

Array of invocation parameters to use when instantiating action controllers

$_invokeParams : array

Default

array()
 

Path delimiter character

$_pathDelimiter : string

Default

'_'
 

Response object to pass to action controllers, if any

$_response : \Zend_Controller_Response_Abstract | null

Default

null
 

Word delimiter characters

$_wordDelimiter : array

Default

array('-', '.')