1 | <?php |
||
11 | abstract class Receiver |
||
12 | { |
||
13 | /** |
||
14 | * @var CommandBus |
||
15 | */ |
||
16 | protected $commandBus; |
||
17 | |||
18 | /** |
||
19 | * @param CommandBus $commandBus |
||
20 | */ |
||
21 | 8 | public function __construct(CommandBus $commandBus) |
|
25 | |||
26 | /** |
||
27 | * Handles the message |
||
28 | * |
||
29 | * @param Message $message |
||
30 | */ |
||
31 | abstract public function handle(Message $message); |
||
32 | |||
33 | /** |
||
34 | * Makes the receiver callable to be able to register it in a router |
||
35 | * |
||
36 | * @param Message $message |
||
37 | * |
||
38 | * @return mixed |
||
39 | */ |
||
40 | 2 | public function __invoke(Message $message) |
|
44 | } |
||
45 |