setName($this->commandName) ->setDescription($this->commandDescription) ->addArgument( $this->commandArgumentName, InputArgument::OPTIONAL, $this->commandArgumentDescription ) ->addOption( $this->commandOptionName, null, InputOption::VALUE_NONE, $this->commandOptionDescription ) ; } protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getArgument($this->commandArgumentName); if ($name) { $text = 'Hello '.$name; } else { $text = 'Hello'; } if ($input->getOption($this->commandOptionName)) { $text = strtoupper($text); } $output->writeln($text); return Command::SUCCESS; } }