/**
  * 
  * @param string $class
  * @return ClassAnnotationHolder
  */
 public function parseClass($class)
 {
     $ref = new ReflectionClass($class);
     $classAnnotationHolder = new ClassAnnotationHolder($ref);
     $classAnnotations = $this->annotationReader->getClassAnnotations($ref);
     foreach ($classAnnotations as $annotation) {
         $classAnnotationHolder->addAnnotation($annotation);
     }
     foreach ($ref->getMethods() as $method) {
         // zf can't process abstract methods for now, wrap with "try" block
         $methodAnnotationHolder = new MethodAnnotationHolder($method);
         $methodAnnotations = $this->annotationReader->getMethodAnnotations($method);
         foreach ($methodAnnotations as $annotation) {
             $methodAnnotationHolder->addAnnotation($annotation);
         }
         $classAnnotationHolder->addMethod($methodAnnotationHolder);
     }
     return $classAnnotationHolder;
 }
Ejemplo n.º 2
0
 /**
  * 
  * @param ClassScanner $class
  * @return ClassAnnotationHolder
  */
 public function parseClass(ClassScanner $class)
 {
     $classAnnotationHolder = new ClassAnnotationHolder($class);
     $classAnnotations = $class->getAnnotations($this->annotationManager);
     if ($classAnnotations instanceof AnnotationCollection) {
         foreach ($classAnnotations as $annotation) {
             $classAnnotationHolder->addAnnotation($annotation);
         }
     } else {
         $classAnnotations = new AnnotationCollection(array());
     }
     foreach ($class->getMethods() as $method) {
         // zf can't process abstract methods for now, wrap with "try" block
         $methodAnnotationHolder = new MethodAnnotationHolder($method);
         $methodAnnotations = $method->getAnnotations($this->annotationManager);
         if ($methodAnnotations instanceof AnnotationCollection) {
             foreach ($methodAnnotations as $annotation) {
                 $methodAnnotationHolder->addAnnotation($annotation);
             }
         }
         $classAnnotationHolder->addMethod($methodAnnotationHolder);
     }
     return $classAnnotationHolder;
 }