コード例 #1
0
 /**
  * Runs the command.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  */
 public function run(InputInterface $input, OutputInterface $output)
 {
     // add the application arguments and options
     $this->mergeApplicationDefinition();
     // bind the input against the command specific arguments/options
     try {
         $input->bind($this->definition);
     } catch (\Exception $e) {
         if (!$this->ignoreValidationErrors) {
             throw $e;
         }
     }
     $this->initialize($input, $output);
     if ($input->isInteractive()) {
         $this->interact($input, $output);
     }
     $input->validate();
     if ($this->code) {
         return call_user_func($this->code, $input, $output);
     } else {
         return $this->execute($input, $output);
     }
 }