Пример #1
0
 function execute(Io $io, Argv $argv)
 {
     $question = new ChoiceQuestion('Whats your favorite sports', ['baskerball', 'foot ball', 'ping pang'], 0);
     $question->setMaxAttempts(3);
     $question->setMultiSelect(true);
     $answer = $this->getHelper('Question')->ask($question);
     $io->write(sprintf("You like %s", implode(', ', $answer)));
 }
Пример #2
0
 function execute(Io $io, Argv $argv)
 {
     $type = $argv->getOption('type');
     $paths = $this->getClearPaths();
     if (!empty($type)) {
         $paths = array_intersect_key($paths, array_flip(explode(',', $type)));
     }
     $this->clearPaths($paths);
     $io->writeln('Clear ok!');
 }
Пример #3
0
 /**
  * 渲染异常
  * 
  * @param \Exception $e
  */
 protected function renderException(\Exception $e)
 {
     $messages = [get_class($e), '<error>' . $e->getMessage() . '</error>'];
     $this->io->writeln(PHP_EOL . implode(PHP_EOL, $messages));
 }
Пример #4
0
 /**
  * (non-PHPdoc)
  * @see \Slince\Console\Command::execute()
  */
 function execute(Io $io, Argv $argv)
 {
     $commandName = $argv->getArgument('command_name');
     $command = $this->console->find($commandName);
     $io->write($this->getCommandHelp($command));
 }