API Documentation

Zend/Controller/Dispatcher/Standard.php

Show: inherited
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 24594 2012-01-05 21:27:01Z matthew $  

\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

Propertyprotectedarray  $_controllerDirectory= 'array()'

Controller directory(ies)

Default valuearray()Details
Type
array
Propertyprotectedstring  $_curDirectory= ''

Current dispatchable directory

Details
Type
string
Propertyprotectedstring  $_curModule= ''

Current module (formatted)

Details
Type
string

Methods

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

Constructor: Set current module to default value

Parameters
Name Type Description
$params array
methodpublicaddControllerDirectory( string $path, string $module = null ) : \Zend_Controller_Dispatcher_Standard

Add a single path to the controller directory stack

Parameters
Name Type Description
$path string
$module string
Returns
Type Description
\Zend_Controller_Dispatcher_Standard
methodpublicclassToFilename( string $class ) : string

Convert a class name to a filename

Parameters
Name Type Description
$class string
Returns
Type Description
string
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 {@link setParam()}.

Parameters
Name Type Description
$request \Zend_Controller_Request_Abstract
$response \Zend_Controller_Response_Abstract
Throws
Exception Description
\Zend_Controller_Dispatcher_Exception
methodpublicformatClassName( string $moduleName, string $className ) : string

Format action class name

Parameters
Name Type Description
$moduleName string

Name of the current module

$className string

Name of the action class

Returns
Type Description
string Formatted class name
methodpublicformatModuleName( string $unformatted ) : string

Format the module name.

Parameters
Name Type Description
$unformatted string
Returns
Type Description
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
Name Type Description
$request \Zend_Controller_Request_Abstract
Returns
Type Description
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
Name Type Description
$request \Zend_Controller_Request_Abstract
Returns
Type Description
string|false Returns 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
Name Type Description
$module string

Module name

Returns
Type Description
array|string Returns array of all directories by default, single module directory if module argument provided
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
Name Type Description
$request \Zend_Controller_Request_Abstract
Returns
Type Description
string
methodpublicgetDispatchDirectory( ) : string

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

Returns
Type Description
string
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
Name Type Description
$request
Returns
Type Description
boolean
methodpublicisValidModule( string $module ) : bool

Determine if a given module is valid

Parameters
Name Type Description
$module string
Returns
Type Description
bool
methodpublicloadClass( string $className ) : string

Load a controller class

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

Parameters
Name Type Description
$className string
Returns
Type Description
string Class name loaded
Throws
Exception Description
\Zend_Controller_Dispatcher_Exception if class not loaded
methodpublicremoveControllerDirectory( string $module ) : bool

Remove a controller directory by module name

Parameters
Name Type Description
$module string
Returns
Type Description
bool
methodpublicsetControllerDirectory( array|string $directory,  $module = null ) : \Zend_Controller_Dispatcher_Standard

Set controller directory

Parameters
Name Type Description
$directory array|string
$module
Returns
Type Description
\Zend_Controller_Dispatcher_Standard
Documentation was generated by DocBlox 0.15.1.