$listeners $listeners : array<string,array<int,(array|callable|string)[]>> 存储监听器:[事件类][优先级][] = 监听器. Type array> —
$container $container : \Symfony\Component\DependencyInjection\ContainerInterface Type \Symfony\Component\DependencyInjection\ContainerInterface
__construct() __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container) : mixed Parameters \Symfony\Component\DependencyInjection\ContainerInterface $container Returns mixed —
addListener() addListener(string $eventClass, array|callable|string $listener, int $priority) : void 添加监听器. Parameters string $eventClass 事件类名 array|callable|string $listener 回调、[对象, 方法]、类名 int $priority 优先级,数值越大越先执行
addSubscriber() addSubscriber(\Framework\Event\ListenerInterface $subscriber) : void 批量注册实现了 ListenerInterface 的监听器类 支持两种格式: 1. [['methodName', 100], ...] - 主流框架风格 2. ['method'=>'m','priority'=>100] - 新手友好风格 Parameters \Framework\Event\ListenerInterface $subscriber
dispatch() dispatch(object $event) : object 分发事件,执行所有匹配的监听器. Parameters object $event Returns object —
getListenersForEvent() getListenersForEvent(object $event) : iterable 获取某个事件的所有监听器(按优先级合并后返回). Parameters object $event Returns iterable —
hasListeners() hasListeners(object $event) : bool 检查是否有监听器监听该事件. Parameters object $event Returns bool —
normalizeSubscriptions() normalizeSubscriptions(array $config) : array 将不同格式的订阅配置标准化为统一结构. Parameters array $config 原始配置 Returns array —
normalizeSubscriptions1() normalizeSubscriptions1(array $config) : array Parameters array $config Returns array —
resolveListener() resolveListener(array|callable|string $listener) : ?callable 解析监听器,支持: - [obj, 'method'] - 'ClassName::method' - 'ServiceName'(自动从容器获取) - 闭包/匿名函数. Parameters array|callable|string $listener Returns ?callable —