| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | protected function execute(InputInterface $input, OutputInterface $output): void |
||
| 23 | { |
||
| 24 | $json = $input->getArgument('json-data'); |
||
| 25 | $data = json_decode($json, true); |
||
|
|
|||
| 26 | |||
| 27 | if (!is_array($data)) { |
||
| 28 | throw new \InvalidArgumentException('Invalid json data.'); |
||
| 29 | } |
||
| 30 | |||
| 31 | $queue = $this->createConfigFactory($input, $output)->createQueue(); |
||
| 32 | $task = $queue->put($data); |
||
| 33 | |||
| 34 | $output->writeln(sprintf( |
||
| 35 | '<comment>%s</comment> was successfully put to <info>%s</info> (#<comment>%d</comment>).', |
||
| 36 | json_encode($task->getData()), |
||
| 37 | $queue->getName(), |
||
| 38 | $task->getId() |
||
| 39 | )); |
||
| 42 |