bind() публичный Метод

绑定实例
public bind ( Definition $definition )
$definition think\console\input\Definition A InputDefinition instance
Пример #1
0
 /**
  * 执行
  * @param Input  $input
  * @param Output $output
  * @return int
  * @throws \Exception
  * @see setCode()
  * @see execute()
  */
 public function run(Input $input, Output $output)
 {
     $this->input = $input;
     $this->output = $output;
     $this->getSynopsis(true);
     $this->getSynopsis(false);
     $this->mergeConsoleDefinition();
     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) {
         $statusCode = call_user_func($this->code, $input, $output);
     } else {
         $statusCode = $this->execute($input, $output);
     }
     return is_numeric($statusCode) ? (int) $statusCode : 0;
 }