Zend\Code\Scanner\ClassScanner::getAnnotations PHP Method

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
    public function getAnnotations(Annotation\AnnotationManager $annotationManager)
    {
        if (($docComment = $this->getDocComment()) == '') {
            return false;
        }
        return new AnnotationScanner($annotationManager, $docComment, $this->nameInformation);
    }

Usage Example

 /**
  * @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;
 }
All Usage Examples Of Zend\Code\Scanner\ClassScanner::getAnnotations