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:
pzinovkin
2010-02-26 22:33:07 +00:00
parent 1b422d87ba
commit e33f2a8536
5 changed files with 121 additions and 34 deletions

View File

@ -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());
} */
}
}
}