eee
This commit is contained in:
+14
-3
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user