/** * * @param \Interfaces\RequestInterface $request * @return type Controller * @throws WrongControllerException * @throws ActionNotFoundException */ public function startController(RequestInterface $request) { try { $controller = 'Main\\Controller\\' . $request->getController(); $controllerInstance = class_exists($controller) ? new $controller($request->getAction(), $request->getArgumets()) : new ErrorController('404'); } catch (\Exception\WrongControllerException $e) { $e->displayErrors(); } catch (\Exception\ActionNotFoundException $e) { $e->displayErrors(); } //return $controllerInstance->getView(); }