MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
Referência à classe Parser

Membros públicos

 __construct (Lexer $lexer=null)
 
 getLexer ()
 
 setAutoloadAnnotations ($bool)
 
 setAnnotationCreationFunction (Closure $func)
 
 getAutoloadAnnotations ()
 
 setDefaultAnnotationNamespace ($defaultNamespace)
 
 setAnnotationNamespaceAlias ($namespace, $alias)
 
 getNamespaceAliases ()
 
 parse ($docBlockString, $context='')
 
 match ($token)
 
 Annotations ()
 
 Annotation ()
 
 Values ()
 
 Value ()
 
 PlainValue ()
 
 FieldAssignment ()
 
 Arrayx ()
 
 ArrayEntry ()
 

Membros protegidos

 newAnnotation ($name, array $values)
 

Atributos Protegidos

 $isNestedAnnotation = false
 

Descrição detalhada

A simple parser for docblock annotations.

This Parser can be subclassed to customize certain aspects of the annotation parsing and/or creation process. Note though that currently no special care is taken to maintain full backwards compatibility for subclasses. Implementation details of the default Parser can change without explicit notice.

Desde
2.0
Autor
Benjamin Eberlei konta.nosp@m.kt@b.nosp@m.eberl.nosp@m.ei.d.nosp@m.e
Guilherme Blanco guilh.nosp@m.erme.nosp@m.blanc.nosp@m.o@ho.nosp@m.tmail.nosp@m..com
Jonathan Wage jonwa.nosp@m.ge@g.nosp@m.mail..nosp@m.com
Roman Borschel roman.nosp@m.@cod.nosp@m.e-fac.nosp@m.tory.nosp@m..org

Definido na linha 38 do ficheiro Parser.php.

Documentação dos Construtores & Destrutor

◆ __construct()

__construct ( Lexer $lexer = null)

Constructs a new AnnotationParser.

Definido na linha 95 do ficheiro Parser.php.

Documentação das funções

◆ Annotation()

Annotation ::= "@" AnnotationName ["(" [Values] ")"] AnnotationName ::= QualifiedName | SimpleName | AliasedName QualifiedName ::= NameSpacePart "\" {NameSpacePart ""}* SimpleName AliasedName ::= Alias ":" SimpleName NameSpacePart ::= identifier SimpleName ::= identifier Alias ::= identifier

Retorna
mixed False if it is not a valid annotation.

Definido na linha 300 do ficheiro Parser.php.

◆ Annotations()

Annotations ( )

Annotations ::= Annotation {[ "*" ]* [Annotation]}*

Retorna
array

Definido na linha 264 do ficheiro Parser.php.

◆ ArrayEntry()

ArrayEntry ( )

ArrayEntry ::= Value | KeyValuePair KeyValuePair ::= Key "=" PlainValue Key ::= string | integer

Retorna
array

Definido na linha 512 do ficheiro Parser.php.

◆ Arrayx()

Arrayx ( )

Array ::= "{" ArrayEntry {"," ArrayEntry}* "}"

Retorna
array

Definido na linha 478 do ficheiro Parser.php.

◆ FieldAssignment()

FieldAssignment ( )

FieldAssignment ::= FieldName "=" PlainValue FieldName ::= identifier

Retorna
array

Definido na linha 464 do ficheiro Parser.php.

◆ getAutoloadAnnotations()

getAutoloadAnnotations ( )

Gets a flag whether to try to autoload annotation classes.

Veja também
setAutoloadAnnotations
Retorna
boolean

Definido na linha 149 do ficheiro Parser.php.

◆ getLexer()

getLexer ( )

Gets the lexer used by this parser.

Retorna
Lexer The lexer.

Definido na linha 105 do ficheiro Parser.php.

◆ getNamespaceAliases()

getNamespaceAliases ( )

Gets the namespace alias mappings used by this parser.

Retorna
array The namespace alias mappings.

Definido na linha 181 do ficheiro Parser.php.

◆ match()

match ( $token)

Attempts to match the given token with the current lookahead token. If they match, updates the lookahead token; otherwise raises a syntax error.

Parâmetros
intToken type.
Retorna
bool True if tokens match; false otherwise.

Definido na linha 221 do ficheiro Parser.php.

◆ newAnnotation()

newAnnotation ( $name,
array $values )
protected

Constructs a new annotation with a given map of values.

The default construction procedure is to instantiate a new object of a class with the same name as the annotation. Subclasses can override this method to change the construction process of new annotations.

Parâmetros
stringThe name of the annotation.
arrayThe map of annotation values.
Retorna
mixed The new annotation with the given values.

Definido na linha 541 do ficheiro Parser.php.

◆ parse()

parse ( $docBlockString,
$context = '' )

Parses the given docblock string for annotations.

Parâmetros
string$docBlockStringThe docblock string to parse.
string$contextThe parsing context.
Retorna
array Array of annotations. If no annotations are found, an empty array is returned.

Definido na linha 193 do ficheiro Parser.php.

◆ PlainValue()

PlainValue ( )

PlainValue ::= integer | string | float | boolean | Array | Annotation

Retorna
mixed

Definido na linha 422 do ficheiro Parser.php.

◆ setAnnotationCreationFunction()

setAnnotationCreationFunction ( Closure $func)

Sets the custom function to use for creating new annotations.

The function is supplied two arguments. The first argument is the name of the annotation and the second argument an array of values for this annotation. The function is assumed to return an object or NULL. Whenever the function returns NULL for an annotation, the parser falls back to the default annotation creation process.

Whenever the function returns NULL for an annotation, the implementation falls back to the default annotation creation process.

Parâmetros
Closure$func

Definido na linha 138 do ficheiro Parser.php.

◆ setAnnotationNamespaceAlias()

setAnnotationNamespaceAlias ( $namespace,
$alias )

Sets an alias for an annotation namespace.

Parâmetros
string$namespace
string$alias

Definido na linha 171 do ficheiro Parser.php.

◆ setAutoloadAnnotations()

setAutoloadAnnotations ( $bool)

Sets a flag whether to try to autoload annotation classes, as well as to distinguish between what is an annotation and what not by triggering autoloading.

NOTE: Autoloading of annotation classes is inefficient and requires silently failing autoloaders. In particular, setting this option to TRUE renders the Parser incompatible with a ClassLoader.

Parâmetros
boolean$boolBoolean flag.

Definido na linha 119 do ficheiro Parser.php.

◆ setDefaultAnnotationNamespace()

setDefaultAnnotationNamespace ( $defaultNamespace)

Sets the default namespace that is assumed for an annotation that does not define a namespace prefix.

Parâmetros
string$defaultNamespace

Definido na linha 160 do ficheiro Parser.php.

◆ Value()

Value ( )

Value ::= PlainValue | FieldAssignment

Retorna
mixed

Definido na linha 406 do ficheiro Parser.php.

◆ Values()

Values ( )

Values ::= Array | Value {"," Value}*

Retorna
array

Definido na linha 364 do ficheiro Parser.php.

Documentação dos campos e atributos

◆ $isNestedAnnotation

$isNestedAnnotation = false
protected

Definido na linha 61 do ficheiro Parser.php.


A documentação para esta classe foi gerada a partir do seguinte ficheiro: