Exemple #1
0
 /**
  * Controller Constructor
  *
  * @param string $view_path          Chemin absolu des vues
  * @param string $template_filename  Nom du fichier du template
  */
 public function __construct(string $view_path = null, string $template_filename = null)
 {
     $this->view_path = Path::getAppPath();
     if (is_null($view_path)) {
         $this->view_path .= '/app/View/';
     } else {
         $this->view_path .= $view_path;
     }
     if (is_null($template_filename)) {
         $this->template_filename = 'default';
     } else {
         $this->template_filename = $template_filename;
     }
 }
Exemple #2
0
 /**
  * Config Constructor
  *
  * @param string $config_filename Nom du fichier de configuration
  * @param string $config_path     Chemin absolu du/des fichier(s) de configuration
  * @throws ConfigException
  */
 public function __construct(string $config_filename, string $config_path = null)
 {
     if (is_null($config_path)) {
         $config_path = Path::getAppPath() . '/config/';
     }
     try {
         $config_complete_path = $config_path . $config_filename;
         $file_extension = explode('.', $config_filename);
         $file_extension = end($file_extension);
         $file_type = '\\Lohkai\\Library\\File\\' . ucfirst(strtolower($file_extension)) . 'File';
         $file = new $file_type($config_complete_path);
         $this->config_settings = $file->getFileContent();
     } catch (FileException $e) {
         throw new ConfigException($e->displayMessage());
     }
 }