This commit is contained in:
2023-04-17 01:39:32 +08:00
parent 0e4d0efdb3
commit e035b6248e
+2 -12
View File
@@ -19,25 +19,15 @@ class EventDispatch extends Component implements EventDispatcherInterface
{ {
/**
* @param EventProvider $eventProvider
* @throws Exception
*/
public function __construct(public EventProvider $eventProvider)
{
parent::__construct();
}
/** /**
* @param object $event * @param object $event
* @return object * @return object
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface|\ReflectionException
*/ */
public function dispatch(object $event): object public function dispatch(object $event): object
{ {
$lists = $this->eventProvider->getListenersForEvent($event); $lists = Kiri::getDi()->get(EventProvider::class)->getListenersForEvent($event);
if (!$lists->valid()) { if (!$lists->valid()) {
return $event; return $event;
} }