From 100ce506eac8ac0a02926742e871f19359d828f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 3 Mar 2022 18:30:59 +0800 Subject: [PATCH] modify plugin name --- EventDispatch.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/EventDispatch.php b/EventDispatch.php index d159c49..a3ac012 100644 --- a/EventDispatch.php +++ b/EventDispatch.php @@ -2,8 +2,8 @@ namespace Kiri\Events; -use Kiri\Abstracts\Component; use Kiri; +use Kiri\Abstracts\Component; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Psr\EventDispatcher\EventDispatcherInterface; @@ -17,6 +17,17 @@ class EventDispatch extends Component implements EventDispatcherInterface { + /** + * @param EventProvider $eventProvider + * @param array $config + * @throws \Exception + */ + public function __construct(public EventProvider $eventProvider, array $config = []) + { + parent::__construct($config); + } + + /** * @param object $event * @return object @@ -25,7 +36,7 @@ class EventDispatch extends Component implements EventDispatcherInterface */ public function dispatch(object $event): object { - $lists = $this->getEventProvider()->getListenersForEvent($event); + $lists = $this->eventProvider->getListenersForEvent($event); foreach ($lists as $listener) { /** @var Struct $list */ $listener($event);