コード例 #1
0
 public function testAnnotationDoesNotExist()
 {
     $annotation = new MockAnnotation();
     $collection = new AnnotationCollection();
     $collection->addAnnotation($annotation);
     $this->assertFalse($collection->exists(MockAnnotation2::class));
 }
コード例 #2
0
 /**
  * Get the return type for a response return
  *
  * @return null|string
  */
 public function getResponseType()
 {
     if (!$this->annotations->exists(ResponseType::NAME)) {
         return null;
     }
     /** @var ResponseType $returnAnnotation */
     $returnAnnotation = $this->annotations->get(ResponseType::NAME);
     return $returnAnnotation->getType();
 }
コード例 #3
0
 /**
  * Add unique class annotations to collection
  *
  * @param ReflectionClass $reflectionClass
  * @param AnnotationCollection $annotationCollection
  */
 private function getAdditionalClassAnnotations(ReflectionClass $reflectionClass, AnnotationCollection $annotationCollection)
 {
     $annotations = $this->reader->getClassAnnotations($reflectionClass);
     $annotations = $this->getDynamoAnnotations($annotations);
     foreach ($annotations as $annotation) {
         // skip annotations that already exist on method
         if ($annotationCollection->exists($annotation->getName())) {
             continue;
         }
         $annotationCollection->addAnnotation($annotation);
     }
 }