Replace if block with switch case for extensibility

This commit is contained in:
2011-08-06 14:55:29 +01:00
parent 9697654594
commit b93efc9878

View File

@@ -11,24 +11,27 @@ class RippingCluster_Main extends SihnonFramework_Main {
protected function __construct() { protected function __construct() {
parent::__construct(); parent::__construct();
$request_string = isset($_GET['l']) ? $_GET['l'] : '';
$this->request = new RippingCluster_RequestParser($request_string);
if (HBC_File == 'index') {
$this->smarty = new Smarty();
$this->smarty->template_dir = './source/templates';
$this->smarty->compile_dir = './tmp/templates';
$this->smarty->cache_dir = './tmp/cache';
$this->smarty->config_dir = './config';
$this->smarty->registerPlugin('modifier', 'formatDuration', array('RippingCluster_Main', 'formatDuration'));
$this->smarty->assign('version', '0.1'); $request_string = isset($_GET['l']) ? $_GET['l'] : '';
$this->smarty->assign('messages', array());
$this->request = new RippingCluster_RequestParser($request_string);
$this->smarty->assign('base_uri', $this->base_uri);
switch (HBC_File) {
case 'index': {
$this->smarty = new Smarty();
$this->smarty->template_dir = './source/templates';
$this->smarty->compile_dir = './tmp/templates';
$this->smarty->cache_dir = './tmp/cache';
$this->smarty->config_dir = './config';
$this->smarty->registerPlugin('modifier', 'formatDuration', array('RippingCluster_Main', 'formatDuration'));
$this->smarty->assign('version', '0.1');
$this->smarty->assign('messages', array());
$this->smarty->assign('base_uri', $this->base_uri);
} break;
} }
} }
@@ -37,14 +40,14 @@ class RippingCluster_Main extends SihnonFramework_Main {
} }
/** /**
* *
* @return RippingCluster_RequestParser * @return RippingCluster_RequestParser
*/ */
public function request() { public function request() {
return $this->request; return $this->request;
} }
} }
?> ?>