1 | <?php |
||
12 | class LaravelLocator implements LocatorInterface |
||
13 | { |
||
14 | |||
15 | protected $handlers; |
||
16 | |||
17 | /** |
||
18 | * Bind a handler instance to receive all commands with a certain class |
||
19 | * |
||
20 | * @param string $handler Handler to receive class name |
||
21 | * @param string $commandClassName Command class e.g. "My\TaskAddedCommand" |
||
22 | */ |
||
23 | 6 | public function addHandler($handler, $commandClassName) |
|
28 | |||
29 | /** |
||
30 | * Allows you to add multiple handlers at once. |
||
31 | * |
||
32 | * The map should be an array in the format of: |
||
33 | * [ |
||
34 | * AddTaskCommand::class => $someHandlerClassName, |
||
35 | * CompleteTaskCommand::class => $someHandlerClassName, |
||
36 | * ] |
||
37 | * |
||
38 | * @param array $commandClassToHandlerMap |
||
39 | */ |
||
40 | 1 | public function addHandlers(array $commandClassToHandlerMap) |
|
46 | |||
47 | /** |
||
48 | * Retrieves the handler for a specified command |
||
49 | * |
||
50 | * @param string $commandName |
||
51 | * |
||
52 | * @return object |
||
53 | * |
||
54 | * @throws MissingHandlerException |
||
55 | */ |
||
56 | 6 | public function getHandlerForCommand($commandName) |
|
64 | } |
||
65 |