Skip to content

Commit 9f8a963

Browse files
committed
Add json format to the dump command
1 parent cb4093e commit 9f8a963

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Command/DumpEncryptedFieldsMapCommand.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ public function __construct(private readonly ServiceCollectionInterface $documen
3838

3939
protected function configure(): void
4040
{
41-
$this->addOption('format', 'f', InputOption::VALUE_REQUIRED, 'The output format for the encrypted fields map (yaml, php)', 'yaml');
41+
$this->addOption(
42+
'format',
43+
'f',
44+
InputOption::VALUE_REQUIRED,
45+
'The output format for the encrypted fields map (yaml, php)',
46+
'yaml',
47+
['yaml', 'php', 'json']
48+
);
4249
}
4350

4451
protected function execute(InputInterface $input, OutputInterface $output): int
@@ -77,6 +84,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7784
case 'php':
7885
$outputContent = var_export($encryptedFieldsMap, true);
7986
break;
87+
case 'json':
88+
$outputContent = json_encode($encryptedFieldsMap, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR);
89+
break;
8090
default:
8191
$io->error(sprintf('Unknown format "%s"', $format));
8292

0 commit comments

Comments
 (0)