1 | <?php |
||
11 | class EventDispatchingDecorator implements Decorator |
||
12 | { |
||
13 | /** |
||
14 | * @var EventDispatcher |
||
15 | */ |
||
16 | protected $dispatcher; |
||
17 | |||
18 | /** |
||
19 | * @var CommandBus |
||
20 | */ |
||
21 | protected $innerCommandBus; |
||
22 | |||
23 | /** |
||
24 | * @param EventDispatcher $dispatcher |
||
25 | * @param CommandBus $innerCommandBus |
||
26 | */ |
||
27 | public function __construct(EventDispatcher $dispatcher, CommandBus $innerCommandBus = null) |
||
32 | |||
33 | public function setInnerBus(CommandBus $bus) |
||
37 | |||
38 | /** |
||
39 | * Execute a command and dispatch and event |
||
40 | * |
||
41 | * @param Command $command |
||
42 | * @return mixed |
||
43 | * @throws \Exception |
||
44 | */ |
||
45 | public function execute(Command $command) |
||
59 | |||
60 | /** |
||
61 | * Get the event name for a given Command |
||
62 | * |
||
63 | * @param Command $command |
||
64 | * @return string |
||
65 | */ |
||
66 | protected function getEventName(Command $command) |
||
70 | } |
||
71 |