1 | <?php |
||
14 | class SimpleCommandBus implements CommandBus |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | private $handlers = []; |
||
20 | |||
21 | /** |
||
22 | * @var \Tactics\CommandBusBundle\NamingStrategy\NamingStrategy |
||
23 | */ |
||
24 | private $namingStrategy; |
||
25 | |||
26 | /**e |
||
27 | * @param NamingStrategy $namingStrategy |
||
28 | */ |
||
29 | public function __construct(NamingStrategy $namingStrategy) |
||
33 | |||
34 | /** |
||
35 | * @inheritDoc |
||
36 | */ |
||
37 | public function registerHandler(CommandHandler $handler) |
||
42 | |||
43 | /** |
||
44 | * @inheritDoc |
||
45 | */ |
||
46 | public function getHandlers() |
||
50 | |||
51 | /** |
||
52 | * @inheritDoc |
||
53 | */ |
||
54 | public function handle(Command $command) |
||
64 | |||
65 | /** |
||
66 | * @param CommandHandler $handler |
||
67 | * @throws DuplicateHandlerException |
||
68 | */ |
||
69 | private function guardAgainstDuplicateHandlers(CommandHandler $handler) |
||
75 | |||
76 | /** |
||
77 | * @param string $needle |
||
78 | * @return CommandHandler |
||
79 | */ |
||
80 | private function findHandler($needle) |
||
86 | } |