Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | class ActionHandlerPool |
||
21 | { |
||
22 | /** @var ActionHandlerInterface[] */ |
||
23 | protected $handlers; |
||
24 | |||
25 | /** |
||
26 | * @param ActionHandlerInterface[] $handlers |
||
27 | */ |
||
28 | public function __construct(array $handlers = []) |
||
33 | } |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param ActionHandlerInterface $handler |
||
38 | * |
||
39 | * @return static |
||
40 | */ |
||
41 | public function registerActionHandler(ActionHandlerInterface $handler) |
||
42 | { |
||
43 | $this->handlers[$handler->getSupportedAction()] = $handler; |
||
44 | |||
45 | return $this; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param string $action on of @see {ActionEnum} |
||
50 | * |
||
51 | * @return ActionHandlerInterface |
||
52 | * @throws \RuntimeException when can't find corresponding handler |
||
53 | */ |
||
54 | public function getHandlerForAction($action) |
||
61 | } |
||
62 | } |
||
63 |