Skip to content
Snippets Groups Projects
Select Git revision
  • ed779f3ba952190a5175f01d4dddb92f48397af2
  • main default protected
  • v0.2.1
  • v0.2.0
  • v0.1.2
  • v0.1.0
  • v0.1.1
7 results

TestCommand.php

  • Christoph Reiter's avatar
    Reiter, Christoph authored
    And print a newline at the end
    ed779f3b
    History
    TestCommand.php 828 B
    <?php
    
    declare(strict_types=1);
    
    namespace DBP\API\StarterBundle\Command;
    
    use Symfony\Component\Console\Command\Command;
    use Symfony\Component\Console\Input\InputArgument;
    use Symfony\Component\Console\Input\InputInterface;
    use Symfony\Component\Console\Output\OutputInterface;
    
    class TestCommand extends Command
    {
        protected static $defaultName = 'dbp:my-custom-command';
    
        public function __construct()
        {
            parent::__construct();
        }
    
        protected function configure()
        {
            $this->addArgument('argument', InputArgument::REQUIRED, 'Example.');
            $this->setDescription('Hey there!');
        }
    
        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $argument = $input->getArgument('argument');
            $output->writeln($argument);
    
            return 0;
        }
    }