public function parse($className) {


        try {
            $class = new \ReflectionClass($className);
        } catch (\ReflectionException $e) {
            return new ClassAnnotations($className, array(), array(), array());
        }


        // get the master annotations
        $classComment = $class->getDocComment();
        $classAnnotations = $this->getCommentAnnotations($classComment);
        $classAnnotations["comment"] = array(new Annotation("comment", $this->cleanComment($classComment)));


        $fieldAnnotations = array();
        $properties = $class->getProperties();

        foreach ($properties as $property) {

            if ($property->isStatic())
                continue;


            $fieldComment = $this->getCommentAnnotations($property->getDocComment());
            $fieldAnnotations[$property->getName()] = $fieldComment;

            $fieldAnnotations[$property->getName()]["comment"] = array(new Annotation("comment", $this->cleanComment($property->getDocComment())));

        }


        $methodAnnotations = array();
        $methods = $class->getMethods();

        foreach ($methods as $method) {

            if ($method->isStatic() || $method->isPrivate() || $method->isProtected())
                continue;
            $methodComment = $this->getCommentAnnotations($method->getDocComment());
            $methodAnnotations[$method->getName()] = $methodComment;

            if ($method->getDeclaringClass()->getName() != $className) {
                $methodAnnotations[$method->getName()]["inherited"] = 1;
            }

            $methodAnnotations[$method->getName()]["comment"] = array(new Annotation("comment", $this->cleanComment($method->getDocComment())));


        }


        return new ClassAnnotations($className, $classAnnotations, $fieldAnnotations, $methodAnnotations);

    }
public function parse($className) {


        try {
            $class = new \ReflectionClass($className);
        } catch (\ReflectionException $e) {
            return new ClassAnnotations($className, array(), array(), array());
        }


        // get the master annotations
        $classComment = $class->getDocComment();
        $classAnnotations = $this->getCommentAnnotations($classComment);
        $classAnnotations["comment"] = array(new Annotation("comment", $this->cleanComment($classComment)));


        $fieldAnnotations = array();
        $properties = $class->getProperties();

        foreach ($properties as $property) {

            if ($property->isStatic())
                continue;


            $fieldComment = $this->getCommentAnnotations($property->getDocComment());
            $fieldAnnotations[$property->getName()] = $fieldComment;

            $fieldAnnotations[$property->getName()]["comment"] = array(new Annotation("comment", $this->cleanComment($property->getDocComment())));

        }


        $methodAnnotations = array();
        $methods = $class->getMethods();

        foreach ($methods as $method) {

            if ($method->isStatic() || $method->isPrivate() || $method->isProtected())
                continue;
            $methodComment = $this->getCommentAnnotations($method->getDocComment());
            $methodAnnotations[$method->getName()] = $methodComment;

            if ($method->getDeclaringClass()->getName() != $className) {
                $methodAnnotations[$method->getName()]["inherited"] = 1;
            }

            $methodAnnotations[$method->getName()]["comment"] = array(new Annotation("comment", $this->cleanComment($method->getDocComment())));


        }


        return new ClassAnnotations($className, $classAnnotations, $fieldAnnotations, $methodAnnotations);

    }
public function parse ( $ className ) { try { $ class = new \ ReflectionClass ( $ className ) ; } catch ( \ ReflectionException $ e ) { return new ClassAnnotations ( $ className , array ( ) , array ( ) , array ( ) ) ; } // get the master annotations $ classComment = $ class -> getDocComment ( ) ; $ classAnnotations = $ this -> getCommentAnnotations ( $ classComment ) ; $ classAnnotations [ "comment" ] = array ( new Annotation ( "comment" , $ this -> cleanComment ( $ classComment ) ) ) ; $ fieldAnnotations = array ( ) ; $ properties = $ class -> getProperties ( ) ; foreach ( $ properties as $ property ) { if ( $ property -> isStatic ( ) ) continue ; $ fieldComment = $ this -> getCommentAnnotations ( $ property -> getDocComment ( ) ) ; $ fieldAnnotations [ $ property -> getName ( ) ] = $ fieldComment ; $ fieldAnnotations [ $ property -> getName ( ) ] [ "comment" ] = array ( new Annotation ( "comment" , $ this -> cleanComment ( $ property -> getDocComment ( ) ) ) ) ; } $ methodAnnotations = array ( ) ; $ methods = $ class -> getMethods ( ) ; foreach ( $ methods as $ method ) { if ( $ method -> isStatic ( ) || $ method -> isPrivate ( ) || $ method -> isProtected ( ) ) continue ; $ methodComment = $ this -> getCommentAnnotations ( $ method -> getDocComment ( ) ) ; $ methodAnnotations [ $ method -> getName ( ) ] = $ methodComment ; if ( $ method -> getDeclaringClass ( ) -> getName ( ) != $ className ) { $ methodAnnotations [ $ method -> getName ( ) ] [ "inherited" ] = 1 ; } $ methodAnnotations [ $ method -> getName ( ) ] [ "comment" ] = array ( new Annotation ( "comment" , $ this -> cleanComment ( $ method -> getDocComment ( ) ) ) ) ; } return new ClassAnnotations ( $ className , $ classAnnotations , $ fieldAnnotations , $ methodAnnotations ) ; }
Parse annotations for a class
Parse annotations for a class