mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-18 05:04:51 +08:00
add sort param
This commit is contained in:
parent
0a979e3674
commit
fcc4f48231
@ -41,13 +41,18 @@ class AnnotationMap
|
||||
* 添加一个独立的注解到全局注解列表中
|
||||
*
|
||||
* @param AnnotationBase $annotation 注解对象
|
||||
* @param bool $sort 是否在添加后排序(默认为 False)
|
||||
*/
|
||||
public static function addSingleAnnotation(AnnotationBase $annotation): void
|
||||
public static function addSingleAnnotation(AnnotationBase $annotation, bool $sort = false): void
|
||||
{
|
||||
self::$_list[get_class($annotation)][] = $annotation;
|
||||
if ($annotation->class !== '') {
|
||||
self::$_map[$annotation->class][$annotation->method][] = $annotation;
|
||||
}
|
||||
|
||||
if ($sort) {
|
||||
self::sortAnnotationList();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +64,7 @@ class AnnotationMap
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序所有的注解
|
||||
* 排序所有的注解(仅排序 List,不排序 Map)
|
||||
*/
|
||||
public static function sortAnnotationList(): void
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user