Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 100ce506ea | |||
| a4c50f975e |
+17
-3
@@ -2,8 +2,10 @@
|
||||
|
||||
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;
|
||||
use Psr\EventDispatcher\StoppableEventInterface;
|
||||
|
||||
@@ -15,14 +17,26 @@ 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
|
||||
* @throws \ReflectionException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user