Controller/Dispatcher/Standard.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Controller  
Subpackage
Dispatcher  
Version
$Id: Standard.php 24861 2012-06-01 23:40:13Z adamlundrigan $  

\Zend_Controller_Dispatcher_Standard

Package: Zend\Controller\Dispatcher
Parent(s)
\Zend_Controller_Dispatcher_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedarray $_controllerDirectory = array()
Controller directory(ies)
Default valuearray()Details
Type
array
>VPropertyprotectedstring $_curDirectory
Current dispatchable directory
Details
Type
string
>VPropertyprotectedstring $_curModule
Current module (formatted)
Details
Type
string
>VPropertyprotectedstring $_defaultAction = 'index'
inherited
Default action
Inherited from: \Zend_Controller_Dispatcher_Abstract::$$_defaultAction
Default value'index'Details
Type
string
Inherited_from
\Zend_Controller_Dispatcher_Abstract::$$_defaultAction  
>VPropertyprotectedstring $_defaultController = 'index'
inherited
Default controller
Inherited from: \Zend_Controller_Dispatcher_Abstract::$$_defaultController
Default value'index'Details
Type
string
Inherited_from
\Zend_Controller_Dispatcher_Abstract::$$_defaultController  
>VPropertyprotectedstring $_defaultModule = 'default'
inherited
Default module
Inherited from: \Zend_Controller_Dispatcher_Abstract::$$_defaultModule
Default value'default'Details
Type
string
Inherited_from
\Zend_Controller_Dispatcher_Abstract::$$_defaultModule  
>VPropertyprotected\Zend_Controller_Front $_frontController
inherited
Front Controller instance
Inherited from: \Zend_Controller_Dispatcher_Abstract::$$_frontController
>VPropertyprotectedarray $_invokeParams = array()
inherited
Array of invocation parameters to use when instantiating action controllers
Inherited from: \Zend_Controller_Dispatcher_Abstract::$$_invokeParams
Default valuearray()Details
Type
array
Inherited_from
\Zend_Controller_Dispatcher_Abstract::$$_invokeParams  
>VPropertyprotectedstring $_pathDelimiter = '_'
inherited
Path delimiter character
Inherited from: \Zend_Controller_Dispatcher_Abstract::$$_pathDelimiter
Default value'_'Details
Type
string
Inherited_from
\Zend_Controller_Dispatcher_Abstract::$$_pathDelimiter  
>VPropertyprotected\Zend_Controller_Response_Abstract|null $_response = null
inherited
Response object to pass to action controllers, if any
Inherited from: \Zend_Controller_Dispatcher_Abstract::$$_response
>VPropertyprotectedarray $_wordDelimiter = array('-', '.')
inherited
Word delimiter characters
Inherited from: \Zend_Controller_Dispatcher_Abstract::$$_wordDelimiter
Default valuearray('-', '.')Details
Type
array
Inherited_from
\Zend_Controller_Dispatcher_Abstract::$$_wordDelimiter  

Methods

methodpublic__construct(array $params = array()) : void

Constructor: Set current module to default value

Parameters
NameTypeDescription
$paramsarray
methodprotected_formatName(string $unformatted, boolean $isAction = false) : string
inherited

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

Inherited from: \Zend_Controller_Dispatcher_Abstract::_formatName()

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
NameTypeDescription
$unformattedstring
$isActionboolean

Defaults to false

Returns
TypeDescription
string
methodpublic_verifyDelimiter(string | array $spec) : array
inherited

Verify delimiter

Inherited from: \Zend_Controller_Dispatcher_Abstract::_verifyDelimiter()

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

Parameters
NameTypeDescription
$specstring | array
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Controller_Dispatcher_Exceptionwith invalid delimiters
methodpublicaddControllerDirectory(string $path, string $module = null) : \Zend_Controller_Dispatcher_Standard

Add a single path to the controller directory stack

Parameters
NameTypeDescription
$pathstring
$modulestring
Returns
TypeDescription
\Zend_Controller_Dispatcher_Standard
methodpublicclassToFilename(string $class) : string

Convert a class name to a filename

Parameters
NameTypeDescription
$classstring
Returns
TypeDescription
string
methodpublicclearParams(null | string | array $name = null) : \Zend_Controller_Dispatcher_Abstract
inherited

Clear the controller parameter stack

Inherited from: \Zend_Controller_Dispatcher_Abstract::clearParams()

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.

Parameters
NameTypeDescription
$namenull | string | array

single key or array of keys for params to clear

Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
methodpublicdispatch(\Zend_Controller_Request_Abstract $request, \Zend_Controller_Response_Abstract $response) : void

Dispatch to a controller/action

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
NameTypeDescription
$request\Zend_Controller_Request_Abstract
$response\Zend_Controller_Response_Abstract
Throws
ExceptionDescription
\Zend_Controller_Dispatcher_Exception
methodpublicformatActionName(string $unformatted) : string
inherited

Formats a string into an action name.

Inherited from: \Zend_Controller_Dispatcher_Abstract::formatActionName()

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.

Parameters
NameTypeDescription
$unformattedstring
Returns
TypeDescription
string
methodpublicformatClassName(string $moduleName, string $className) : string

Format action class name

Parameters
NameTypeDescription
$moduleNamestring

Name of the current module

$classNamestring

Name of the action class

Returns
TypeDescription
stringFormatted class name
methodpublicformatControllerName(string $unformatted) : string
inherited

Formats a string into a controller name.

Inherited from: \Zend_Controller_Dispatcher_Abstract::formatControllerName()

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.

Parameters
NameTypeDescription
$unformattedstring
Returns
TypeDescription
string
methodpublicformatModuleName(string $unformatted) : string

Format the module name.

This is used to take a raw module name, such as one that would be packaged inside a request object, and reformat it to a proper directory/class name that a class extending Zend_Controller_Action would use.

Parameters
NameTypeDescription
$unformattedstring
Returns
TypeDescription
string
methodpublicgetActionMethod(\Zend_Controller_Request_Abstract $request) : string

Determine the action name

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

Returns formatted action name

Parameters
NameTypeDescription
$request\Zend_Controller_Request_Abstract
Returns
TypeDescription
string
methodpublicgetControllerClass(\Zend_Controller_Request_Abstract $request) : string | false

Get controller class name

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

Parameters
NameTypeDescription
$request\Zend_Controller_Request_Abstract
Returns
TypeDescription
string | falseReturns class name on success
methodpublicgetControllerDirectory(string $module = null) : array | string

Return the currently set directories for Zend_Controller_Action class lookup

If a module is specified, returns just that directory.

Parameters
NameTypeDescription
$modulestring

Module name

Returns
TypeDescription
array | stringReturns array of all directories by default, single module directory if module argument provided
methodpublicgetDefaultAction() : string
inherited

Retrieve the default action name (minus formatting)

Inherited from: \Zend_Controller_Dispatcher_Abstract::getDefaultAction()
Returns
TypeDescription
string
methodpublicgetDefaultControllerClass(\Zend_Controller_Request_Abstract $request) : string

Retrieve default controller class

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
NameTypeDescription
$request\Zend_Controller_Request_Abstract
Returns
TypeDescription
string
methodpublicgetDefaultControllerName() : string
inherited

Retrieve the default controller name (minus formatting)

Inherited from: \Zend_Controller_Dispatcher_Abstract::getDefaultControllerName()
Returns
TypeDescription
string
methodpublicgetDefaultModule() : string
inherited

Retrieve the default module

Inherited from: \Zend_Controller_Dispatcher_Abstract::getDefaultModule()
Returns
TypeDescription
string
methodpublicgetDispatchDirectory() : string

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

Returns
TypeDescription
string
methodpublicgetFrontController() : \Zend_Controller_Front
inherited

Retrieve front controller instance

Inherited from: \Zend_Controller_Dispatcher_Abstract::getFrontController()
Returns
TypeDescription
\Zend_Controller_Front
methodpublicgetParam(string $name) : mixed
inherited

Retrieve a single parameter from the controller parameter stack

Inherited from: \Zend_Controller_Dispatcher_Abstract::getParam()
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
mixed
methodpublicgetParams() : array
inherited

Retrieve action controller instantiation parameters

Inherited from: \Zend_Controller_Dispatcher_Abstract::getParams()
Returns
TypeDescription
array
methodpublicgetPathDelimiter() : array
inherited

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

Inherited from: \Zend_Controller_Dispatcher_Abstract::getPathDelimiter()
Returns
TypeDescription
array
methodpublicgetResponse() : \Zend_Controller_Response_Abstract | null
inherited

Return the registered response object

Inherited from: \Zend_Controller_Dispatcher_Abstract::getResponse()
Returns
TypeDescription
\Zend_Controller_Response_Abstract | null
methodpublicgetWordDelimiter() : array
inherited

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

Inherited from: \Zend_Controller_Dispatcher_Abstract::getWordDelimiter()
Returns
TypeDescription
array
methodpublicisDispatchable( $request) : boolean

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

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
NameTypeDescription
$request
Returns
TypeDescription
boolean
methodpublicisValidModule(string $module) : bool

Determine if a given module is valid

Parameters
NameTypeDescription
$modulestring
Returns
TypeDescription
bool
methodpublicloadClass(string $className) : string

Load a controller class

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
NameTypeDescription
$classNamestring
Returns
TypeDescription
stringClass name loaded
Throws
ExceptionDescription
\Zend_Controller_Dispatcher_Exceptionif class not loaded
methodpublicremoveControllerDirectory(string $module) : bool

Remove a controller directory by module name

Parameters
NameTypeDescription
$modulestring
Returns
TypeDescription
bool
methodpublicsetControllerDirectory(array | string $directory,  $module = null) : \Zend_Controller_Dispatcher_Standard

Set controller directory

Specify a string or an array; if an array is specified, all paths will be added.

Parameters
NameTypeDescription
$directoryarray | string
$module
Returns
TypeDescription
\Zend_Controller_Dispatcher_Standard
methodpublicsetDefaultAction(string $action) : \Zend_Controller_Dispatcher_Abstract
inherited

Set the default action (minus any formatting)

Inherited from: \Zend_Controller_Dispatcher_Abstract::setDefaultAction()
Parameters
NameTypeDescription
$actionstring
Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
methodpublicsetDefaultControllerName(string $controller) : \Zend_Controller_Dispatcher_Abstract
inherited

Set the default controller (minus any formatting)

Inherited from: \Zend_Controller_Dispatcher_Abstract::setDefaultControllerName()
Parameters
NameTypeDescription
$controllerstring
Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
methodpublicsetDefaultModule(string $module) : \Zend_Controller_Dispatcher_Abstract
inherited

Set the default module

Inherited from: \Zend_Controller_Dispatcher_Abstract::setDefaultModule()
Parameters
NameTypeDescription
$modulestring
Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
methodpublicsetFrontController(\Zend_Controller_Front $controller) : \Zend_Controller_Dispatcher_Abstract
inherited

Set front controller instance

Inherited from: \Zend_Controller_Dispatcher_Abstract::setFrontController()
Parameters
NameTypeDescription
$controller\Zend_Controller_Front
Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
methodpublicsetParam(string $name, mixed $value) : \Zend_Controller_Dispatcher_Abstract
inherited

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

Inherited from: \Zend_Controller_Dispatcher_Abstract::setParam()
Parameters
NameTypeDescription
$namestring
$valuemixed
Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
methodpublicsetParams(array $params) : \Zend_Controller_Dispatcher_Abstract
inherited

Set parameters to pass to action controller constructors

Inherited from: \Zend_Controller_Dispatcher_Abstract::setParams()
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
methodpublicsetPathDelimiter(string $spec) : \Zend_Controller_Dispatcher_Abstract
inherited

Set path delimiter

Inherited from: \Zend_Controller_Dispatcher_Abstract::setPathDelimiter()

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

Parameters
NameTypeDescription
$specstring
Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
methodpublicsetResponse(\Zend_Controller_Response_Abstract | null $response = null) : \Zend_Controller_Dispatcher_Abstract
inherited

Set response object to pass to action controllers

Inherited from: \Zend_Controller_Dispatcher_Abstract::setResponse()
Parameters
NameTypeDescription
$response\Zend_Controller_Response_Abstract | null
Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
methodpublicsetWordDelimiter(string | array $spec) : \Zend_Controller_Dispatcher_Abstract
inherited

Set word delimiter

Inherited from: \Zend_Controller_Dispatcher_Abstract::setWordDelimiter()

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

Parameters
NameTypeDescription
$specstring | array
Returns
TypeDescription
\Zend_Controller_Dispatcher_Abstract
Documentation was generated by phpDocumentor 2.0.0a12.