Code formatting
This commit is contained in:
@ -11,21 +11,21 @@
|
||||
|
||||
abstract class Action
|
||||
{
|
||||
|
||||
|
||||
protected $template;
|
||||
|
||||
|
||||
/**
|
||||
* @var PHPView
|
||||
*/
|
||||
protected $view;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->view = FrontController::getInstance()->getView();
|
||||
$this->extractParams();
|
||||
$this->execute();
|
||||
}
|
||||
|
||||
|
||||
protected function extractParams()
|
||||
{
|
||||
foreach (Env::getParam() as $name => $value) {
|
||||
@ -34,12 +34,12 @@ abstract class Action
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
abstract protected function execute();
|
||||
|
||||
|
||||
/**
|
||||
* Redirect
|
||||
*
|
||||
*
|
||||
* @param mixed $url
|
||||
*/
|
||||
protected function redirect($url = null)
|
||||
@ -47,15 +47,15 @@ abstract class Action
|
||||
header('Location: ' . (($url) ? $url : Env::getRequestUri()));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
protected function getTemplate()
|
||||
{
|
||||
$class = get_class($this);
|
||||
$template = ($this->template) ? $this->template : substr($class, 0, -6/*strlen('Action')*/);
|
||||
$template = ($this->template) ? $this->template : substr($class, 0, -6 /*strlen('Action')*/);
|
||||
$dir = array_slice(explode('/', Load::getFilePath($class)), -2, 1);
|
||||
return '/actions/' . array_pop($dir) . '/' . $template;
|
||||
}
|
||||
|
||||
|
||||
public function fetch()
|
||||
{
|
||||
$this->view->assignObject($this);
|
||||
|
Reference in New Issue
Block a user