/** * The constructor the initializes the instance with the * data passed with the token. * * @param string $annotationName The annotation name * @param array $values The annotation values */ public function __construct($annotationName, array $values = array()) { // pass values to parent constructor parent::__construct($annotationName, $values); // initialize the URL pattern values if (!isset($this->values[AnnotationKeys::URL_PATTERN])) { $this->values[AnnotationKeys::URL_PATTERN] = array(); } // initialize the initialization parameter values if (!isset($this->values[AnnotationKeys::INIT_PARAMS])) { $this->values[AnnotationKeys::INIT_PARAMS] = array(); } }
/** * Returns the method annotations. * * @return array The method annotations * @see \AppserverIo\Lang\Reflection\MethodInterface::getAnnotations() */ public function getAnnotations() { // check if the annotations has been loaded if (isset($this->annotations) === false) { $this->annotations = ReflectionAnnotation::fromReflectionMethod($this); } // return the annotations return $this->annotations; }
/** * Initializes and returns an array with annotation instances from the doc comment * found in the passed reflection class instance. * * @param \AppserverIo\Lang\Reflection\ClassInterface $reflectionClass The reflection class to load the doc comment from * * @return array The array with the ReflectionAnnotation instances loaded from the passed reflection class * @see \AppserverIo\Lang\Reflection\ReflectionAnnotation::fromDocComment() */ public static function fromReflectionClass(ClassInterface $reflectionClass) { // load the reflection method data we need to initialize the annotations $aliases = $reflectionClass->getAnnotationAliases(); $ignore = $reflectionClass->getAnnotationsToIgnore(); $docComment = $reflectionClass->toPhpReflectionClass()->getDocComment(); // load and return the annotations found in the doc comment return ReflectionAnnotation::fromDocComment($docComment, $ignore, $aliases); }