/
home
/
obinna
/
html
/
mixchief_app
/
vendor
/
symfony
/
maker-bundle
/
src
/
Resources
/
skeleton
/
command
/
Upload File
HOME
<?= "<?php\n"; ?> namespace <?= $namespace; ?>; <?php if ($use_attributes && $use_command_attribute): ?> use Symfony\Component\Console\Attribute\AsCommand; <?php endif; ?> use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; <?php if ($use_attributes && $use_command_attribute): ?> #[AsCommand( name: '<?= $command_name; ?>', description: 'Add a short description for your command', )] <?php endif; ?> class <?= $class_name; ?> extends Command { <?php if (!$use_attributes || !$use_command_attribute): ?> protected static $defaultName = '<?= $command_name; ?>'; protected static $defaultDescription = 'Add a short description for your command'; <?php endif; ?> protected function configure(): void { $this <?= $set_description ? " ->setDescription(self::\$defaultDescription)\n" : '' ?> ->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description') ->addOption('option1', null, InputOption::VALUE_NONE, 'Option description') ; } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $arg1 = $input->getArgument('arg1'); if ($arg1) { $io->note(sprintf('You passed an argument: %s', $arg1)); } if ($input->getOption('option1')) { // ... } $io->success('You have a new command! Now make it your own! Pass --help to see your options.'); return <?= defined('Symfony\Component\Console\Command\Command::SUCCESS') ? 'Command::SUCCESS' : '0' ?>; } }