eee
This commit is contained in:
+13
-2
@@ -11,6 +11,7 @@ use Psr\Container\NotFoundExceptionInterface;
|
|||||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||||
use Psr\EventDispatcher\StoppableEventInterface;
|
use Psr\EventDispatcher\StoppableEventInterface;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
|
use SplPriorityQueue;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,12 +24,22 @@ class EventDispatch extends Component implements EventDispatcherInterface
|
|||||||
/**
|
/**
|
||||||
* @param object $event
|
* @param object $event
|
||||||
* @return object
|
* @return object
|
||||||
* @throws ContainerExceptionInterface
|
|
||||||
* @throws NotFoundExceptionInterface|ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function dispatch(object $event): object
|
public function dispatch(object $event): object
|
||||||
{
|
{
|
||||||
$lists = make(EventProvider::class)->getListenersForEvent($event);
|
$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()) {
|
if ($lists->isEmpty()) {
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user