| 1 | <?php |
||
| 16 | class EventEmitterMiddleware implements Middleware |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var \hiapi\event\EventStorageInterface |
||
| 20 | */ |
||
| 21 | private $eventStorage; |
||
| 22 | /** |
||
| 23 | * @var EmitterInterface |
||
| 24 | */ |
||
| 25 | private $emitter; |
||
| 26 | /** |
||
| 27 | * @var LoggerInterface |
||
| 28 | */ |
||
| 29 | private $logger; |
||
| 30 | |||
| 31 | public function __construct(EventStorageInterface $eventStorage, EmitterInterface $emitter, LoggerInterface $logger) |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param object $command |
||
| 40 | * @param callable $next |
||
| 41 | * |
||
| 42 | * @return mixed |
||
| 43 | */ |
||
| 44 | public function execute($command, callable $next) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @param EventInterface[] $events |
||
| 56 | */ |
||
| 57 | private function emitEvents(array $events = []): void |
||
| 69 | } |
||
| 70 |