예제 #1
0
 /**
  * Get a configuration item.
  * If no item is requested, the entire configuration array will be returned.
  * @param  string  $key
  * @param  mixed   $default
  * @return array
  */
 public static function get($key, $default = null)
 {
     if (empty($key)) {
         throw new \Exception("\$key argument is not valid", 500);
     }
     list($file, $item) = static::_parse($key);
     if (file_exists(path('app') . 'configuration/' . $file . EXT)) {
         $items = (include path('app') . 'configuration/' . $file . EXT);
     } else {
         throw new \Exception("{$file} configuration file is missing", 500);
     }
     if (is_null($item)) {
         return $items;
     } else {
         return ArrayMethods::array_get($items, $item);
     }
 }