think\console\Input::getArgument PHP Method

getArgument() public method

根据名称获取参数
public getArgument ( string $name ) : mixed
$name string 参数名
return mixed
    public function getArgument($name)
    {
        if (!$this->definition->hasArgument($name)) {
            throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
        }
        return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
    }

Usage Example

Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(Input $input, Output $output)
 {
     if (null === $this->command) {
         $this->command = $this->getConsole()->find($input->getArgument('command_name'));
     }
     $output->describe($this->command, ['raw_text' => $input->getOption('raw')]);
     $this->command = null;
 }
All Usage Examples Of think\console\Input::getArgument