示例#1
0
 /**
  * Register the internal type definitions used by this TypeHound.
  */
 protected static function registerDefinitions()
 {
     static::$definitions = [new CompoundTypes(), new ScalarTypes(), new SpecialTypes()];
 }
示例#2
0
 /**
  * Clear definitions variable.
  */
 protected static final function clearDefinitions()
 {
     static::$definitions = [];
 }
示例#3
0
 /**
  * Load JSON definitions from file (via lazy loading from get())
  *
  * @todo add caching
  */
 protected static function load()
 {
     static::$definitions = array();
     $cache_id = static::CACHE_KEY . static::FILE;
     if (Util\Configuration::read('devmode') == FALSE && extension_loaded('apc') && apc_exists($cache_id) && time() - filemtime(__DIR__ . '/' . static::FILE) > Util\Configuration::read('cache.ttl')) {
         static::$definitions = apc_fetch($cache_id);
     } else {
         // expensive - cache results
         $json = Util\JSON::decode(file_get_contents(__DIR__ . '/' . static::FILE));
         foreach ($json as $property) {
             static::$definitions[$property->name] = new static($property);
         }
         if (extension_loaded('apc')) {
             apc_store($cache_id, static::$definitions, Util\Configuration::read('cache.ttl'));
         }
     }
 }
示例#4
0
 /**
  * Load JSON definitions from file (via lazy loading from get())
  *
  * @todo add caching
  */
 protected static function load()
 {
     static::$definitions = array();
     $json = Util\JSON::decode(file_get_contents(VZ_DIR . static::FILE));
     foreach ($json as $property) {
         static::$definitions[$property->name] = new static($property);
     }
 }
示例#5
0
 /**
  * Flush the registry
  */
 public static function flush()
 {
     static::$definitions = [];
 }