From b7272d83bd06f7ed9c53993ed5a64236be895645 Mon Sep 17 00:00:00 2001 From: Arnaud Oltra Date: Sat, 4 Nov 2023 12:25:48 -0400 Subject: [PATCH] Missing Php cs --- app/src/Command/ExportListCommandsCommand.php | 69 ++++++++++--------- .../Command/ExportListCommandsCommandTest.php | 13 ++-- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/app/src/Command/ExportListCommandsCommand.php b/app/src/Command/ExportListCommandsCommand.php index 489c87d0..c4488073 100644 --- a/app/src/Command/ExportListCommandsCommand.php +++ b/app/src/Command/ExportListCommandsCommand.php @@ -8,42 +8,43 @@ class ExportListCommandsCommand extends Command { - protected static $defaultName = 'app:list-commands'; - - protected function configure() - { - $this - ->setDescription('List all available Symfony commands with their documentation.') - ->setHelp('This command lists all available Symfony commands and their descriptions.'); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $commands = $this->getApplication()->all(); - $commandList = []; - - foreach ($commands as $name => $command) { - $description = $this->sanitizeText($command->getDescription()); - $synopsis = $this->sanitizeText($command->getSynopsis()); - $helper = $this->sanitizeText($command->getHelp()); - - $commandList[$name]['description'] = $description; - $commandList[$name]['synopsis'] = $synopsis; - $commandList[$name]['helper'] = $helper; + protected static $defaultName = 'app:list-commands'; + + protected function configure(): void + { + $this + ->setDescription('List all available Symfony commands with their documentation.') + ->setHelp('This command lists all available Symfony commands and their descriptions.'); } - $jsonOutput = json_encode($commandList, JSON_PRETTY_PRINT); - $output->writeln($jsonOutput); - return 0; - } + protected function execute(InputInterface $input, OutputInterface $output) + { + $commands = $this->getApplication()->all(); + $commandList = []; + + foreach ($commands as $name => $command) { + $description = $this->sanitizeText($command->getDescription()); + $synopsis = $this->sanitizeText($command->getSynopsis()); + $helper = $this->sanitizeText($command->getHelp()); - private function sanitizeText($text) - { - $output = strip_tags($text); - $output = preg_replace('/\s+/', ' ', $output); - $output = str_replace('"', "'", $output); - $output = trim($output); + $commandList[$name]['description'] = $description; + $commandList[$name]['synopsis'] = $synopsis; + $commandList[$name]['helper'] = $helper; + } - return $output; - } + $jsonOutput = json_encode($commandList, \JSON_PRETTY_PRINT); + $output->writeln($jsonOutput); + + return 0; + } + + private function sanitizeText($text) + { + $output = strip_tags($text); + $output = preg_replace('/\s+/', ' ', $output); + $output = str_replace('"', "'", $output); + $output = trim($output); + + return $output; + } } diff --git a/tests/Command/ExportListCommandsCommandTest.php b/tests/Command/ExportListCommandsCommandTest.php index e27793c0..d1f5973e 100644 --- a/tests/Command/ExportListCommandsCommandTest.php +++ b/tests/Command/ExportListCommandsCommandTest.php @@ -2,12 +2,12 @@ namespace App\Tests\Command; -use App\Tests\TestCase; use App\Command\ExportListCommandsCommand; +use App\Tests\TestCase; +use Draw\Component\Tester\Application\CommandDataTester; +use Draw\Component\Tester\Application\CommandTestTrait; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputOption; -use Draw\Component\Tester\Application\CommandTestTrait; -use Draw\Component\Tester\Application\CommandDataTester; /** * @covers \App\Command\ExportListCommandsCommand @@ -63,7 +63,8 @@ public function testExecute(): void private function getDefaultExpectation(): string { - $jsonContent = file_get_contents(__DIR__.'/result/defaultExport.json'); - return $jsonContent; + $jsonContent = file_get_contents(__DIR__.'/result/defaultExport.json'); + + return $jsonContent; } -} \ No newline at end of file +}