Beispiel #1
0
 private function loadLanguageFile()
 {
     $languageFilePath = Application::getConfigPath() . DIRECTORY_SEPARATOR . self::LANGUAGES_FOLDER . DIRECTORY_SEPARATOR . $this->langString . '.php';
     if (!file_exists($languageFilePath)) {
         throw new \Exception($languageFilePath . ' file could not be found');
     }
     $filePathVocabulary = (require $languageFilePath);
     if (!is_array($filePathVocabulary)) {
         throw new \Exception('language aliases config file should return an array');
     }
     $this->vocabulary = $filePathVocabulary;
     return;
 }
Beispiel #2
0
 private function setConfig()
 {
     $dbConfigFilePath = Application::getConfigPath() . self::DB_CONFIG_FILENAME;
     if (!file_exists($dbConfigFilePath)) {
         throw new \Exception(self::DB_CONFIG_FILENAME . ' config file can not be found');
     }
     $dbConfigArray = (require $dbConfigFilePath);
     if (!is_array($dbConfigArray)) {
         throw new \Exception(self::DB_CONFIG_FILENAME . ' config file should return an array');
     }
     $this->config = $dbConfigArray;
     return;
 }
Beispiel #3
0
 private static function setRoutes()
 {
     $routesFilePath = Application::getConfigPath() . self::ROUTES_FILENAME;
     if (!file_exists($routesFilePath)) {
         throw new \Exception(self::ROUTES_FILENAME . ' config file can not be found');
     }
     $routesArray = (require $routesFilePath);
     if (!is_array($routesArray)) {
         throw new \Exception(self::ROUTES_FILENAME . ' config file should return an array');
     }
     if (sizeof($routesArray) == 0) {
         throw new \Exception(self::ROUTES_FILENAME . ' config file should contain at least one route');
     }
     foreach ($routesArray as $key => $value) {
         if ($key[0] != '/') {
             throw new \Exception('Each route in routes config file should starts from slash');
         }
     }
     self::$routes = $routesArray;
     return;
 }