Ejemplo n.º 1
0
 /**
  * DocCommentを取得する
  *
  * @param mixed $object
  * @return string 
  */
 public static function getDocCommentRaw($object)
 {
     if ($object instanceof ReflectionMethod || $object instanceof ReflectionClass || $object instanceof ReflectionFunction || $object instanceof Injection\Spec) {
         return $object->getDocComment();
     }
     // オブジェクトを判定
     if (is_callable($object) && is_array($object)) {
         $rs = new ReflectionMethod($object[0], $object[1]);
         return $rs->getDocComment();
     }
     if ($object instanceof Closure) {
         $rs = new ReflectionFunction($object);
         return $rs->getDocComment();
     }
     if (is_array($object) && is_callable($object[count($object) - 1])) {
         return self::getDocCommentRaw($object[count($object) - 1]);
     }
     if (is_object($object)) {
         $rs = new ReflectionClass($object);
         return $rs->getDocComment();
     }
     throw new Exception\CantRetriveDocComment($object);
 }