Create a new Controller object
public controller ( string $viewName, array $config = [] ) : |
||
$viewName | string | The name of the view we're getting a Controller for. |
$config | array | Optional MVC configuration values for the Controller object. |
return |
/** * Create a new Controller object * * @param string $viewName The name of the view we're getting a Controller for. * @param array $config Optional MVC configuration values for the Controller object. * * @return Controller */ public function controller($viewName, array $config = array()) { try { return parent::controller($viewName, $config); } catch (ControllerNotFound $e) { $magic = new Magic\ControllerFactory($this->container); return $magic->make($viewName, $config); } }
/** * Create a new Controller object * * @param string $viewName The name of the view we're getting a Controller for. * @param array $config Optional MVC configuration values for the Controller object. * * @return Controller */ public function controller($viewName, array $config = array()) { try { return parent::controller($viewName, $config); } catch (ControllerNotFound $e) { } $controllerClass = $this->container->getNamespacePrefix('inverse') . 'Controller\\' . ucfirst($viewName); try { return $this->createController($controllerClass, $config); } catch (ControllerNotFound $e) { } $controllerClass = $this->container->getNamespacePrefix('inverse') . 'Controller\\' . ucfirst($this->container->inflector->singularize($viewName)); return $this->createController($controllerClass, $config); }