1 | <?php |
||
36 | class DistributedCommandBus implements CommandBusInterface, LoggerAwareInterface |
||
37 | { |
||
38 | |||
39 | const DISPATCH_ERROR_MESSAGE = 'An error occurred while trying to dispatch a command on the DistributedCommandBus'; |
||
40 | |||
41 | /** |
||
42 | * @var CommandBusConnectorInterface |
||
43 | */ |
||
44 | private $connector; |
||
45 | |||
46 | /** |
||
47 | * @var RoutingStrategyInterface |
||
48 | */ |
||
49 | private $routingStrategy; |
||
50 | |||
51 | /** |
||
52 | * @var CommandDispatchInterceptorInterface[] |
||
53 | */ |
||
54 | private $dispatchInterceptors; |
||
55 | |||
56 | /** |
||
57 | * @var LoggerInterface |
||
58 | */ |
||
59 | private $logger; |
||
60 | |||
61 | /** |
||
62 | * @param CommandBusConnectorInterface $connector |
||
63 | * @param RoutingStrategyInterface $routingStrategy |
||
64 | */ |
||
65 | function __construct( |
||
73 | |||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | public function dispatch( |
||
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | public function subscribe($commandName, CommandHandlerInterface $handler) |
||
112 | |||
113 | /** |
||
114 | * {@inheritdoc} |
||
115 | */ |
||
116 | public function unsubscribe($commandName, CommandHandlerInterface $handler) |
||
120 | |||
121 | /** |
||
122 | * Invokes all the dispatch interceptors. |
||
123 | * |
||
124 | * @param CommandMessageInterface $command The original command being dispatched |
||
125 | * @return CommandMessageInterface The command to actually dispatch |
||
126 | */ |
||
127 | protected function intercept(CommandMessageInterface $command) |
||
137 | |||
138 | /** |
||
139 | * @param CommandDispatchInterceptorInterface[] $dispatchInterceptors |
||
140 | */ |
||
141 | public function setDispatchInterceptors(array $dispatchInterceptors) |
||
145 | |||
146 | /** |
||
147 | * {@inheritdoc} |
||
148 | */ |
||
149 | public function setLogger(LoggerInterface $logger) |
||
153 | |||
154 | /** |
||
155 | * {@inheritdoc} |
||
156 | */ |
||
157 | public function getSubscriptions() |
||
161 | |||
162 | |||
163 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.