Test.php 897 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\command;
  3. use Symfony\Component\Console\Command\Command;
  4. use Symfony\Component\Console\Input\InputInterface;
  5. use Symfony\Component\Console\Input\InputOption;
  6. use Symfony\Component\Console\Input\InputArgument;
  7. use Symfony\Component\Console\Output\OutputInterface;
  8. class Test extends Command
  9. {
  10. protected static $defaultName = 'Test:t1';
  11. protected static $defaultDescription = 'Test';
  12. /**
  13. * @return void
  14. */
  15. protected function configure()
  16. {
  17. $this->addArgument('name', InputArgument::OPTIONAL, 'Name description');
  18. }
  19. /**
  20. * @param InputInterface $input
  21. * @param OutputInterface $output
  22. * @return int
  23. */
  24. protected function execute(InputInterface $input, OutputInterface $output)
  25. {
  26. $name = $input->getArgument('name');
  27. $output->writeln('Hello Test');
  28. return self::SUCCESS;
  29. }
  30. }