getAnnotations() public method

Get annotations
public getAnnotations ( Zend\Code\Annotation\AnnotationManager $annotationManager ) : Zend\Code\Annotation\AnnotationCollection
$annotationManager Zend\Code\Annotation\AnnotationManager
return Zend\Code\Annotation\AnnotationCollection
Ejemplo n.º 1
0
 /**
  * @param ClassScanner $classScanner
  * @return array
  */
 protected function processClassAnnotations(ClassScanner $classScanner)
 {
     $result = array();
     $result['name'] = $classScanner->getName();
     foreach ($classScanner->getAnnotations($this->annotationManager) as $annotation) {
         if ($annotation instanceof Annotation\Service) {
             $result['path'] = $annotation->getPath();
             $result['collectionPath'] = $annotation->getCollectionPath();
         } else {
             if ($annotation instanceof Annotation\Entity) {
                 $result['repository'] = $annotation->getRepository();
             } else {
                 if ($annotation instanceof Annotation\XML) {
                     $result['rootElement'] = $annotation->getRootElement();
                 }
             }
         }
     }
     return $result;
 }
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;
 }