Skip to content

Instantly share code, notes, and snippets.

@phalcon
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phalcon/11298335 to your computer and use it in GitHub Desktop.
Save phalcon/11298335 to your computer and use it in GitHub Desktop.
namespace Phalcon\Mvc;
/**
* Phalcon\Mvc\Dispatcher
*
* Dispatching is the process of taking the request object, extracting the module name,
* controller name, action name, and optional parameters contained in it, and then
* instantiating a controller and calling an action of that controller.
*
*<code>
*
* $di = new \Phalcon\Di();
*
* $dispatcher = new \Phalcon\Mvc\Dispatcher();
*
* $dispatcher->setDI($di);
*
* $dispatcher->setControllerName('posts');
* $dispatcher->setActionName('index');
* $dispatcher->setParams(array());
*
* $controller = $dispatcher->dispatch();
*
*</code>
*/
class Dispatcher extends \Phalcon\Dispatcher implements \Phalcon\Mvc\DispatcherInterface
{
protected _handlerSuffix = "Controller";
protected _defaultHandler = "index";
protected _defaultAction = "index";
/**
* Sets the default controller suffix
*
* @param string controllerSuffix
*/
public function setControllerSuffix(string! controllerSuffix)
{
let this->_handlerSuffix = controllerSuffix;
}
/**
* Sets the default controller name
*
* @param string controllerName
*/
public function setDefaultController(string! controllerName)
{
let this->_defaultHandler = controllerName;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment