| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Jose\Component\Console; |
| 6 | |
| 7 | use Jose\Component\Core\Util\JsonConverter; |
| 8 | use JsonSerializable; |
| 9 | use Symfony\Component\Console\Command\Command; |
| 10 | use Symfony\Component\Console\Input\InputInterface; |
| 11 | use Symfony\Component\Console\Output\OutputInterface; |
| 12 | |
| 13 | abstract class ObjectOutputCommand extends Command |
| 14 | { |
| 15 | protected function prepareJsonOutput(InputInterface $input, OutputInterface $output, JsonSerializable $json): void |
| 16 | { |
| 17 | $data = JsonConverter::encode($json); |
| 18 | $output->write($data); |
| 19 | } |
| 20 | } |