Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GenericAnnotationParser Class Reference

Generic annotation parser. More...

Public Member Functions

 onCreateAnnotation (EventInterface $e)
 Listen to onCreateAnnotation, and attempt to return an annotation object instance.
 
 registerAnnotation ($annotation)
 Register annotations.
 
 registerAnnotations ($annotations)
 Register many annotations at once.
 
 hasAnnotation ($class)
 Checks if the manager has annotations for a class.
 
 setAlias ($alias, $class)
 Alias an annotation name.
 

Protected Member Functions

 normalizeAlias ($alias)
 Normalize an alias name.
 
 hasAlias ($alias)
 Do we have an alias by the provided name?
 
 resolveAlias ($alias)
 Resolve an alias to a class name.
 

Protected Attributes

 $aliases = []
 
 $annotationNames = []
 
 $annotations = []
 

Detailed Description

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.

Member Function Documentation

hasAlias (   $alias)
protected

Do we have an alias by the provided name?

Parameters
string$alias
Returns
bool
hasAnnotation (   $class)

Checks if the manager has annotations for a class.

Parameters
string$class
Returns
bool
normalizeAlias (   $alias)
protected

Normalize an alias name.

Parameters
string$alias
Returns
string
onCreateAnnotation ( EventInterface  $e)

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

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
EventInterface$e
Returns
false|AnnotationInterface

Implements ParserInterface.

registerAnnotation (   $annotation)

Register annotations.

Parameters
string | AnnotationInterface$annotationString class name of an AnnotationInterface implementation, or actual instance
Returns
GenericAnnotationParser
Exceptions
Exception\InvalidArgumentException

Implements ParserInterface.

registerAnnotations (   $annotations)

Register many annotations at once.

Parameters
array | Traversable$annotations
Exceptions
Exception\InvalidArgumentException
Returns
GenericAnnotationParser

Implements ParserInterface.

resolveAlias (   $alias)
protected

Resolve an alias to a class name.

Parameters
string$alias
Returns
string
setAlias (   $alias,
  $class 
)

Alias an annotation name.

Parameters
string$alias
string$classMay be either a registered annotation name or another alias
Exceptions
Exception\InvalidArgumentException
Returns
GenericAnnotationParser

Member Data Documentation

$aliases = []
protected
$annotationNames = []
protected
$annotations = []
protected