PHP Class ManaPHP\Mvc\Dispatcher

Inheritance: extends ManaPHP\Component, implements ManaPHP\Mvc\DispatcherInterface
Datei anzeigen Open project: manaphp/manaphp

Protected Properties

Property Type Description
$_actionName string
$_controller Controller
$_controllerName string
$_finished boolean
$_forwarded boolean
$_initializedControllers array
$_moduleName string
$_params array
$_previousActionName string
$_previousControllerName string
$_returnedValue mixed

Public Methods

Method Description
dispatch ( string $module, string $controller, string $action, array $params = [] ) : boolean Dispatches a handle action taking into account the routing parameters
forward ( string $forward, array $params = [] ) Forwards the execution flow to another controller/action Dispatchers are unique per module. Forwarding between modules is not allowed
getActionName ( ) : string Gets the latest dispatched action name
getController ( ) : Controller
getControllerName ( ) : string Gets last dispatched controller name
getModuleName ( ) : string Gets the module where the controller class is
getParam ( string | integer $param, string | array $filters = null, mixed $defaultValue = null ) : mixed Gets a param by its name or numeric index
getParams ( ) : array Gets action params
getPreviousActionName ( ) : string Returns the previous action in the dispatcher
getPreviousControllerName ( ) : string Returns the previous controller in the dispatcher
getReturnedValue ( ) : mixed Returns value returned by the latest dispatched action
hasParam ( string $param ) : boolean
setActionName ( string $actionName ) : static
setControllerName ( string $controllerName ) : static
setParams ( array $params, boolean $merge = true ) : static
setReturnedValue ( mixed $value ) : static Sets the latest returned value by an action manually
wasForwarded ( ) : boolean Check if the current executed action was forwarded by another one

Method Details

dispatch() public method

Dispatches a handle action taking into account the routing parameters
public dispatch ( string $module, string $controller, string $action, array $params = [] ) : boolean
$module string
$controller string
$action string
$params array
return boolean

forward() public method

$this->dispatcher->forward('posts/index'));
public forward ( string $forward, array $params = [] )
$forward string
$params array

getActionName() public method

Gets the latest dispatched action name
public getActionName ( ) : string
return string

getController() public method

public getController ( ) : Controller
return Controller

getControllerName() public method

Gets last dispatched controller name
public getControllerName ( ) : string
return string

getModuleName() public method

Gets the module where the controller class is
public getModuleName ( ) : string
return string

getParam() public method

Gets a param by its name or numeric index
public getParam ( string | integer $param, string | array $filters = null, mixed $defaultValue = null ) : mixed
$param string | integer
$filters string | array
$defaultValue mixed
return mixed

getParams() public method

Gets action params
public getParams ( ) : array
return array

getPreviousActionName() public method

Returns the previous action in the dispatcher
public getPreviousActionName ( ) : string
return string

getPreviousControllerName() public method

Returns the previous controller in the dispatcher

getReturnedValue() public method

Returns value returned by the latest dispatched action
public getReturnedValue ( ) : mixed
return mixed

hasParam() public method

public hasParam ( string $param ) : boolean
$param string
return boolean

setActionName() public method

public setActionName ( string $actionName ) : static
$actionName string
return static

setControllerName() public method

public setControllerName ( string $controllerName ) : static
$controllerName string
return static

setParams() public method

public setParams ( array $params, boolean $merge = true ) : static
$params array
$merge boolean
return static

setReturnedValue() public method

Sets the latest returned value by an action manually
public setReturnedValue ( mixed $value ) : static
$value mixed
return static

wasForwarded() public method

Check if the current executed action was forwarded by another one
public wasForwarded ( ) : boolean
return boolean

Property Details

$_actionName protected_oe property

protected string $_actionName
return string

$_controller protected_oe property

protected Controller,ManaPHP\Mvc $_controller
return Controller

$_controllerName protected_oe property

protected string $_controllerName
return string

$_finished protected_oe property

protected bool $_finished
return boolean

$_forwarded protected_oe property

protected bool $_forwarded
return boolean

$_initializedControllers protected_oe property

protected array $_initializedControllers
return array

$_moduleName protected_oe property

protected string $_moduleName
return string

$_params protected_oe property

protected array $_params
return array

$_previousActionName protected_oe property

protected string $_previousActionName
return string

$_previousControllerName protected_oe property

protected string $_previousControllerName
return string

$_returnedValue protected_oe property

protected mixed $_returnedValue
return mixed