/** * Gets the annotation list. * * @return AnnotationList A list containing annotation instances. */ public function getAnnotationList() { if ($this->docComment == null) { $this->docComment = new ReflectionDocComment($this); } return $this->docComment->getAnnotationList(); }
/** * Test if the `getAnnotationList` method return a list of all annotations in a doc comment. */ public function testGetAnnotationList() { $reflector = new ReflectionClass(self::TEST_CLASS); $comment = new ReflectionDocComment($reflector); $list = $comment->getAnnotationList(); $this->assertInstanceOf('com\\mohiva\\common\\lang\\AnnotationList', $list); }
/** * Test if can remove a previous stored annotation list. */ public function testRemoveAnnotationList() { /* @var \com\mohiva\common\lang\AnnotationReflector $class */ $class = new ReflectionClass(self::TEST_CLASS); $docReflector = new ReflectionDocComment($class); $annotationList = $docReflector->getAnnotationList(); $key = new HashKey(Hash::ALGO_SHA1, 'php://temp'); $adapter = new ResourceAdapter(new TempResourceContainer(TempFileResource::TYPE)); $container = new AnnotationContainer($adapter, $key); $container->store($class->getDocComment(), $annotationList); $container->remove($class->getDocComment()); $this->assertFalse($container->exists($class->getDocComment())); }