public function testCreateAnnotation() { $param = ezcReflectionAnnotationFactory::createAnnotation('param', array('param', 'string', 'param')); self::assertInstanceOf('ezcReflectionAnnotationParam', $param); $var = ezcReflectionAnnotationFactory::createAnnotation('var', array('var', 'string')); self::assertInstanceOf('ezcReflectionAnnotationVar', $var); $return = ezcReflectionAnnotationFactory::createAnnotation('return', array('return', 'string', 'hello', 'world')); self::assertInstanceOf('ezcReflectionAnnotationReturn', $return); }
/** * @param string $line * @return void */ protected function parseAnnotation($line) { if (strlen($line) > 0) { if ($line[0] == '@') { $line = substr($line, 1); $words = preg_split('/\\s+/', $line, 4); // split the line by whitespace into up to 4 parts $annotation = ezcReflectionAnnotationFactory::createAnnotation($words[0], $words); $this->annotations[$annotation->getName()][] = $annotation; $this->lastAnnotation = $annotation; } else { //no leading @, it is assumed a description is multiline if ($this->lastAnnotation != null) { $this->lastAnnotation->addDescriptionLine($line); } } } }