mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-02 14:25:38 +08:00
add sort param
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user