1 | <?php |
||
13 | class CommandBus |
||
14 | { |
||
15 | /** |
||
16 | * @var callable |
||
17 | */ |
||
18 | private $middlewareChain; |
||
19 | |||
20 | /** |
||
21 | * @param Middleware[] $middleware |
||
22 | */ |
||
23 | 8 | public function __construct(array $middleware) |
|
27 | |||
28 | /** |
||
29 | * Executes the given command and optionally returns a value |
||
30 | * |
||
31 | * @param object $command |
||
32 | * |
||
33 | * @return mixed |
||
34 | */ |
||
35 | 5 | public function handle($command) |
|
44 | |||
45 | /** |
||
46 | * @param Middleware[] $middlewareList |
||
47 | * |
||
48 | * @return callable |
||
49 | */ |
||
50 | 8 | private function createExecutionChain($middlewareList): callable |
|
68 | } |
||
69 |