| Conditions | 3 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 31 | protected function execute(InputInterface $input, OutputInterface $output): int |
||
| 32 | { |
||
| 33 | /** @var array $shares */ |
||
| 34 | $shares = $input->getArgument('shares'); |
||
| 35 | if (empty($shares)) { |
||
| 36 | /** @var QuestionHelper $dialog */ |
||
| 37 | $helper = $this->getHelper('question'); |
||
| 38 | $question = new Question('<question>Shared secret</question> <comment>[empty to stop]</comment>: '); |
||
| 39 | $shares = []; |
||
| 40 | while (($share = trim($helper->ask($input, $output, $question))) !== '') { |
||
| 41 | $shares[] = $share; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | $shared = Secret::recover($shares); |
||
| 46 | |||
| 47 | /** @var FormatterHelper $formatter */ |
||
| 48 | $formatter = $this->getHelper('formatter'); |
||
| 49 | $block = $formatter->formatBlock($shared, 'info'); |
||
| 50 | $output->writeln($block); |
||
| 51 | |||
| 52 | return 0; |
||
| 53 | } |
||
| 55 |