1 | <?php |
||
13 | class CommandHandlerLocator implements CommandHandlerLocatorInterface |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * @var CommandHandlerInterface[] |
||
18 | */ |
||
19 | private $handlers = array(); |
||
20 | |||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | public function getCommandHandlerForCommand(CommandInterface $command) |
||
39 | |||
40 | /** |
||
41 | * @return CommandHandlerInterface[] |
||
42 | */ |
||
43 | public function getRegisteredCommandHandlers() |
||
47 | |||
48 | /** |
||
49 | * @param string $commandClassName |
||
50 | * @param CommandHandlerInterface $commandHandler |
||
51 | * |
||
52 | * @throws InvalidArgumentException |
||
53 | */ |
||
54 | public function register($commandClassName, CommandHandlerInterface $commandHandler) |
||
71 | |||
72 | /** |
||
73 | * @param string $commandClassName |
||
74 | * @param string $handlerClassName |
||
75 | * |
||
76 | * @throws InvalidArgumentException |
||
77 | */ |
||
78 | private function assertNamingConventionSatisfied($commandClassName, $handlerClassName) |
||
90 | |||
91 | /** |
||
92 | * @param string $commandClassName |
||
93 | * @param string $handlerClassName |
||
94 | * |
||
95 | * @return bool |
||
96 | */ |
||
97 | private function isNamingConventionSatisfied($commandClassName, $handlerClassName) |
||
103 | |||
104 | /** |
||
105 | * @param string $commandClassName |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | private function getExpectedHandlerName($commandClassName) |
||
118 | |||
119 | /** |
||
120 | * @param string $commandClassName |
||
121 | * |
||
122 | * @return bool |
||
123 | */ |
||
124 | private function isCommandRegistered($commandClassName) |
||
128 | |||
129 | /** |
||
130 | * @param string $commandClassName |
||
131 | */ |
||
132 | private function assertImplementsCommandInterface($commandClassName) |
||
143 | } |
||
144 |