openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

Configuration.class.php (899B)


      1 <?php
      2 
      3 namespace cms\base;
      4 
      5 use configuration\Config;
      6 use util\Request;
      7 use util\Session;
      8 
      9 class Configuration {
     10 
     11 	/**
     12 	 * @return Config
     13 	 */
     14 	public static function Conf()
     15 	{
     16 
     17 		return new Config(self::getConfig() );
     18 
     19 	}
     20 
     21 
     22 	/**
     23 	 * Gives the subset with this key.
     24 	 * @param $key string|array subset key
     25 	 * @return Config
     26 	 */
     27 	public static function subset( $key ) {
     28 		return self::Conf()->subset($key);
     29 	}
     30 
     31 	private static function getConfig()
     32 	{
     33 		return Request::getConfig();
     34 	}
     35 
     36 
     37 	public static function rawConfig() {
     38 		return self::getConfig();
     39 	}
     40 
     41 
     42 	/**
     43 	 * @param $keys
     44 	 */
     45 	public static function get( $keys ) {
     46 
     47 		settype($keys,'array');
     48 
     49 		$value = self::getConfig();
     50 
     51 		foreach( $keys as $key ) {
     52 			if   ( is_array( $value ) ) {
     53 				if   ( isset( $value[$key] ) )
     54 					$value = $value[$key];
     55 				else
     56 					return null;;
     57 			} else {
     58 				return null;
     59 			}
     60 		}
     61 
     62 		return $value;
     63 	}
     64 
     65 }