Code refactoring, #16
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@115 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
@ -104,24 +104,37 @@ class FrontController
|
||||
return $this->router;
|
||||
}
|
||||
|
||||
|
||||
public function execute()
|
||||
{
|
||||
|
||||
try {
|
||||
$request = Env::getRequestUri();
|
||||
$route = $this->getRouter()->route($request);
|
||||
if (! $route) {
|
||||
throw new Exception('Route "' . $request . '" not found');
|
||||
}
|
||||
|
||||
$action_class = $route->getAction();
|
||||
$action = new $action_class();
|
||||
$layout_class = $route->getLayout();
|
||||
$layout = new $layout_class();
|
||||
return $layout->fetch($action);
|
||||
//try {
|
||||
$request = Env::getRequestUri();
|
||||
$route = $this->getRouter()->route($request);
|
||||
if (!$route) {
|
||||
throw new Exception('Route "' . $request . '" not found');
|
||||
}
|
||||
|
||||
$action_class = $route->getAction();
|
||||
$action = new $action_class();
|
||||
$layout_class = $route->getLayout();
|
||||
$layout = new $layout_class();
|
||||
return $layout->fetch($action);
|
||||
//} catch (GeneralException $e) {
|
||||
// throw $e;
|
||||
//} /*catch (Exception $e) {
|
||||
throw new GeneralException($e->getMessage(), $e->getCode());
|
||||
//} */
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
var_dump($e);
|
||||
die('111');
|
||||
|
||||
/*if (DEBUG == true) {
|
||||
return $e->toHtml();
|
||||
} else {
|
||||
$layout = new ErrorLayout();
|
||||
return $layout->fetch($e->getCode());
|
||||
} */
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user