From 04d2d3094b67aa036549cce23e0fb783b7470efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 17 Oct 2023 21:18:52 +0800 Subject: [PATCH] eee --- EventDispatch.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/EventDispatch.php b/EventDispatch.php index 77884b4..389bc54 100644 --- a/EventDispatch.php +++ b/EventDispatch.php @@ -11,6 +11,7 @@ use Psr\Container\NotFoundExceptionInterface; use Psr\EventDispatcher\EventDispatcherInterface; use Psr\EventDispatcher\StoppableEventInterface; use ReflectionException; +use SplPriorityQueue; /** @@ -23,12 +24,22 @@ class EventDispatch extends Component implements EventDispatcherInterface /** * @param object $event * @return object - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface|ReflectionException - */ + */ public function dispatch(object $event): object { $lists = make(EventProvider::class)->getListenersForEvent($event); + + return $this->execute($lists, $event); + } + + + /** + * @param SplPriorityQueue $lists + * @param object $event + * @return object + */ + public function execute(SplPriorityQueue $lists, object $event): object + { if ($lists->isEmpty()) { return $event; }