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 Default

 Methods

Checks if the manager has annotations for a class

hasAnnotation(string $class) : boolean

Parameters

$class

string

Returns

boolean

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.

inherited_from \Zend\Code\Annotation\Parser\ParserInterface::onCreateAnnotation()

Parameters

$e

\Zend\EventManager\EventInterface

Returns

false\Zend\Code\Annotation\AnnotationInterface

Register annotations

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

Parameters

$annotation

string\Zend\Code\Annotation\AnnotationInterface

String class name of an AnnotationInterface implementation, or actual instance

Exceptions

\Zend\Code\Exception\InvalidArgumentException

Returns

\Zend\Code\Annotation\Parser\GenericAnnotationParser

Register many annotations at once

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

Parameters

$annotations

array\Traversable

Exceptions

\Zend\Code\Exception\InvalidArgumentException

Returns

\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

\Zend\Code\Annotation\Parser\GenericAnnotationParser

Do we have an alias by the provided name?

hasAlias(string $alias) : boolean

Parameters

$alias

string

Returns

boolean

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

Default

array()
 

$annotationNames

$annotationNames : array

Default

array()
 

$annotations

$annotations : array<mixed,\Zend\Code\Annotation\AnnotationInterface>

Default

array()