/** * Set a default view, if any. * * @return $this */ private function setDefaultView() { if ($this->session->has(ViewConstants::DEFAULT_VIEW_FOLDER_AND_FILE)) { $this->defaultView = $this->session->get(ViewConstants::DEFAULT_VIEW_FOLDER_AND_FILE); } return $this; }
/** * Generates the path for the default view, extracted from the controller and action. * Stores it in the session, for future use. * * @param $controller * @param $action * @return mixed */ public function generatePathForDefaultView($controller, $action) { $defaultViewFolder = $this->parseDefaultViewFolder($controller); $defaultViewFileName = $action; $this->session->set(ViewConstants::DEFAULT_VIEW_FOLDER, $defaultViewFolder); $this->session->set(ViewConstants::DEFAULT_VIEW_FILE, $defaultViewFileName); $pathForDefaultView = sprintf("%s.%s", $defaultViewFolder, $defaultViewFileName); $this->session->set(ViewConstants::DEFAULT_VIEW_FOLDER_AND_FILE, $pathForDefaultView); return $pathForDefaultView; }