PHP Class Webiny\Component\Bootstrap\Dispatcher

Receives the callback data from the Router and issues the callback. Dispatcher works with standard MVC callback, or with a custom class based callback.
Inheritance: use trait Webiny\Component\StdLib\StdObjectTrait
Mostra file Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
customDispatcher ( string $className, string $action, array $params ) : Dispatcher Creates a Dispatcher instance from a class name.
getAction ( ) : string Returns action name.
getClassName ( ) : string Returns the current class name.
getController ( ) : string Returns the controller name.
getModule ( ) : string Returns the module name.
getParams ( ) : array Returns the current list of parameters.
issueCallback ( ) Calls the defined action on the current class name, passing along the parameters.
mvcDispatcher ( string $module, string $controller, string $action, array $params ) : Dispatcher Creates a Dispatcher instance from MVC parameters.
setAction ( string $action ) Sets the action name.
setClassName ( string $className ) Sets the class name. Note, this will overwrite the current class name, also valid in case of MVC callback.
setController ( string $controller ) Sets the controller name.
setModule ( string $module ) Sets the module name.
setParams ( array $params ) Sets the callback parameters.

Private Methods

Method Description
getApplicationInstance ( ) : Application Create a new Application instance. The method also sets the current configuration and environment inside the Application instance.
getCallbackClassInstance ( ) : mixed Creates class instance from the defined class name.
setTemplate ( mixed $instance ) : boolean Tries to set the view template for the given $instance.

Method Details

customDispatcher() public static method

Creates a Dispatcher instance from a class name.
public static customDispatcher ( string $className, string $action, array $params ) : Dispatcher
$className string Fully qualified class name.
$action string Action name.
$params array Parameters.
return Dispatcher

getAction() public method

Returns action name.
public getAction ( ) : string
return string

getClassName() public method

Returns the current class name.
public getClassName ( ) : string
return string

getController() public method

Returns the controller name.
public getController ( ) : string
return string

getModule() public method

Returns the module name.
public getModule ( ) : string
return string

getParams() public method

Returns the current list of parameters.
public getParams ( ) : array
return array

issueCallback() public method

Calls the defined action on the current class name, passing along the parameters.
public issueCallback ( )

mvcDispatcher() public static method

Creates a Dispatcher instance from MVC parameters.
public static mvcDispatcher ( string $module, string $controller, string $action, array $params ) : Dispatcher
$module string Module name.
$controller string Controller name.
$action string Action name.
$params array Parameters.
return Dispatcher

setAction() public method

Sets the action name.
public setAction ( string $action )
$action string Action name.

setClassName() public method

Sets the class name. Note, this will overwrite the current class name, also valid in case of MVC callback.
public setClassName ( string $className )
$className string Fully qualified class name.

setController() public method

Sets the controller name.
public setController ( string $controller )
$controller string Controller name.

setModule() public method

Sets the module name.
public setModule ( string $module )
$module string Module name.

setParams() public method

Sets the callback parameters.
public setParams ( array $params )
$params array List of parameters.