Generic annotation parser

Expects registration of AnnotationInterface instances. Such instances will be passed annotation content to their initialize() method, which they are then responsible for parsing.

package Zend_Code
subpackage Annotation

 Methods

Checks if the manager has annotations for a class

hasAnnotation(string $class) : bool

Parameters

$class

string

Returns

bool

Listen to onCreateAnnotation, and attempt to return an annotation object instance.

onCreateAnnotation(\Zend\EventManager\EventInterface $e) : false | \Zend\Code\Annotation\AnnotationInterface

If the annotation class or alias is not registered, immediately returns false. Otherwise, resolves the class, clones it, and, if any content is present, calls AnnotationInterface::initialize() with the content.

Parameters

Returns

Register annotations

registerAnnotation(string | \Zend\Code\Annotation\AnnotationInterface $annotation) : \Zend\Code\Annotation\Parser\GenericAnnotationParser

Parameters

$annotation

string\Zend\Code\Annotation\AnnotationInterface

String class name of an AnnotationInterface implementation, or actual instance

Exceptions

\Zend\Code\Exception\InvalidArgumentException

Returns

Register many annotations at once

registerAnnotations(array | \Traversable $annotations) : \Zend\Code\Annotation\Parser\GenericAnnotationParser

Alias an annotation name

setAlias(string $alias, string $class) : \Zend\Code\Annotation\Parser\GenericAnnotationParser

Parameters

$alias

string

$class

string

May be either a registered annotation name or another alias

Exceptions

\Zend\Code\Exception\InvalidArgumentException

Returns

Do we have an alias by the provided name?

hasAlias(string $alias) : bool

Parameters

$alias

string

Returns

bool

Normalize an alias name

normalizeAlias(string $alias) : string

Parameters

$alias

string

Returns

string

Resolve an alias to a class name

resolveAlias(string $alias) : string

Parameters

$alias

string

Returns

string

 Properties

 

$aliases

$aliases : array

 

$annotationNames

$annotationNames : string[]

 

$annotations

$annotations : \Zend\Code\Annotation\AnnotationInterface[]