1 | <?php |
||
18 | class SharepCommandProcessor implements CommandProcessorInterface |
||
19 | { |
||
20 | public const COMMAND = '/sharep'; |
||
21 | /** @var SharepReleaseTaskProcessor */ |
||
22 | private $releaseTaskProcessor; |
||
23 | /** @var SharepHelpMessage */ |
||
24 | private $sharepHelpMessage; |
||
25 | |||
26 | 3 | public function __construct(SharepReleaseTaskProcessor $releaseTaskProcessor, SharepHelpMessage $sharepHelpMessage) |
|
31 | |||
32 | 2 | public function process(CommandData $commandData): Layout |
|
33 | { |
||
34 | /** @var TaskProcessorInterface $taskProcessor */ |
||
35 | 2 | foreach ($this->getTaskProcessors() as $taskProcessor) { |
|
36 | 2 | if ($taskProcessor->support($commandData)) { |
|
37 | return $taskProcessor->process($commandData); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | return $this->sharepHelpMessage->generate(); |
||
42 | } |
||
43 | |||
44 | 2 | private function getTaskProcessors(): array |
|
52 | } |
||
53 |