예제 #1
0
 public static function getInstance($file)
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new Config($file);
     }
     return self::$_instance;
 }
예제 #2
0
파일: Config.php 프로젝트: whereo/framework
 /**
  * get value out of the configuration
  */
 public static function get($key, $default = null)
 {
     self::$default = $default;
     $segments = explode('.', $key);
     $data = self::load(array_shift($segments));
     foreach ($segments as $segment) {
         if (isset($data[$segment])) {
             $data = $data[$segment];
         } else {
             $data = self::$default;
             break;
         }
     }
     return $data;
 }
예제 #3
0
 private static function initDefaultParams()
 {
     /**
      * App root
      */
     if (is_null(self::$appPath)) {
         self::$appPath = __DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR;
     }
     /**
      * Controllers path
      */
     if (is_null(self::$controllersPath)) {
         self::$controllersPath = self::$appPath . "Controllers" . DIRECTORY_SEPARATOR;
     }
     /**
      * Views path
      */
     if (is_null(self::$viewsPath)) {
         self::$viewsPath = self::$appPath . "Views" . DIRECTORY_SEPARATOR;
     }
 }