예제 #1
0
 /**
  * Return an array of APIs supported by the class tree.
  *
  * We require class_name and use reflection for now since only php 5.3 and above supports late static binding.
  */
 static final function get_supported_apis($class_name)
 {
     static $supported_apis;
     if (empty($class_name) || !class_exists($class_name)) {
         trigger_error('get_supported_apis must be provided the name of a defined class.');
     } elseif (!isset($supported_apis[$class_name])) {
         self::$classname = $class_name;
         // providing context for add_api
         while ($class = isset($class) ? $class->getParentClass() : new ReflectionClass($class_name)) {
             if ($class->getMethod('setup_supported_apis')->getDeclaringClass()->getName() == $class->getName()) {
                 $class->getMethod('setup_supported_apis')->invoke(NULL);
             }
         }
         $supported_apis[$class_name] = self::_api_helper('get');
         self::$classname = NULL;
     }
     return $supported_apis[$class_name];
 }