Ejemplo n.º 1
0
 public function __construct($obj)
 {
     $this->info = hphp_get_class_info($obj);
 }
Ejemplo n.º 2
0
 private static function fetch_recur($name)
 {
     if (isset(self::$fetched[$name])) {
         return self::$fetched[$name];
     }
     $info = hphp_get_class_info($name);
     if (empty($info)) {
         throw new ReflectionException("Class {$name} does not exist");
     }
     $abstract = isset($info['abstract']) || isset($info['interface']);
     // flattening the trees, so it's easier for lookups
     foreach ($info['interfaces'] as $interface => $_) {
         $p = self::fetch_recur($interface);
         if ($abstract) {
             $info['methods'] += $p['methods'];
         }
         $info['constants'] += $p['constants'];
         $info['interfaces'] += $p['interfaces'];
     }
     $parent = $info['parent'];
     if (!empty($parent)) {
         $p = self::fetch_recur($parent);
         if (isset($p['interface'])) {
             $info['interfaces'][$parent] = 1;
         } else {
             $info['properties'] += $p['properties'];
         }
         $info['methods'] += $p['methods'];
         $info['constants'] += $p['constants'];
         $info['interfaces'] += $p['interfaces'];
     }
     self::$fetched[$name] = $info;
     return $info;
 }