Zhamao Framework 3.2.4
A high-performance chatbot + web framework
载入中...
搜索中...
未找到
AnnotationParser类 参考

Public 成员函数

 __construct (bool $with_internal_parsers=true)
 
 addSpecialParser (string $class_name, callable $callback)
 
 parse ()
 
 generateAnnotationListFromMap ()
 
 parseSpecial (object|string $annotation, ?array $same_method_annotations=null)
 
 addPsr4Path (string $path, string $indoor_name, array $join_groups=[])
 
 getUsedTime ()
 
 getAnnotationMap ()
 

详细描述

注解解析器

构造及析构函数说明

◆ __construct()

__construct ( bool  $with_internal_parsers = true)

AnnotationParser constructor.

函数调用图:

成员函数说明

◆ addPsr4Path()

addPsr4Path ( string  $path,
string  $indoor_name,
array  $join_groups = [] 
)

添加解析的路径

参数
string$path注册解析注解的路径
string$indoor_name起始命名空间的名称
array$join_groups此类命名空间解析出来的注解要加入的组
函数调用图:

◆ addSpecialParser()

addSpecialParser ( string  $class_name,
callable  $callback 
)

设置自定义的注解解析方法

参数
string$class_name注解类名
callable$callback回调函数

◆ generateAnnotationListFromMap()

generateAnnotationListFromMap ( )

生成排序后的注解列表

◆ getAnnotationMap()

getAnnotationMap ( )

获取注解的注册map

◆ getUsedTime()

getUsedTime ( )

获取解析器调用的时间(秒)

◆ parse()

parse ( )

解析所有传入的 PSR-4 下识别出来的类及下方的注解 返回一个包含三个元素的数组,分别是list、map、tree 其中list为注解列表,key是注解的class名称,value是所有此注解的列表,即[Annotation1, ...] map是类、方法映射表关系的三维数组,即[类名 => [方法名 => [注解1, ...]]] tree是解析中间生成的树结构,内含反射对象,见下方注释

返回
array[]
异常

ReflectionException

函数调用图:

◆ parseSpecial()

parseSpecial ( object|string  $annotation,
?array  $same_method_annotations = null 
)

单独解析特殊注解

参数
object | string$annotation注解对象
null | array$same_method_annotations相同方法下的其他注解列表(可为数组或 null)

该类的文档由以下文件生成: