Ejemplo n.º 1
0
 /**
  *  Configuration to load Haanga
  *
  *  Options:
  *
  *      - (string)   cache_dir 
  *      - (string)   tempalte_dir
  *      - (callback) on_compile
  *      - (boolean)  debug
  *      - (int)      check_ttl
  *      - (callback) check_get
  *      - (callback) check_set
  *      - (boolean)  autoload
  *      - (boolean)  use_hash_filename
  *
  *  @return void
  */
 public static final function configure(array $opts)
 {
     foreach ($opts as $option => $value) {
         switch (strtolower($option)) {
             case 'cache_dir':
                 self::$cache_dir = $value;
                 break;
             case 'template_dir':
                 self::$templates_dir = $value;
                 break;
             case 'bootstrap':
                 if (is_callable($value)) {
                     self::$bootstrap = $value;
                 }
                 break;
             case 'debug':
                 self::enableDebug((bool) $value);
                 break;
             case 'check_ttl':
                 self::$check_ttl = (int) $value;
                 break;
             case 'check_get':
                 if (is_callable($value)) {
                     self::$check_get = $value;
                 }
                 break;
             case 'check_set':
                 if (is_callable($value)) {
                     self::$check_set = $value;
                 }
                 break;
             case 'autoload':
                 self::$use_autoload = (bool) $value;
                 break;
             case 'use_hash_filename':
                 self::$hash_filename = (bool) $value;
                 break;
             case 'compiler':
                 if (is_array($value)) {
                     self::$compiler = $value;
                 }
                 break;
             default:
                 continue;
         }
     }
 }