Symfony\Component\Console\Command\Command::addOption PHP Метод

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

Adds an option.
public addOption ( string $name, string $shortcut = null, integer $mode = null, string $description = '', mixed $default = null ) : Command
$name string The option name
$shortcut string The shortcut (can be null)
$mode integer The option mode: One of the InputOption::VALUE_* constants
$description string A description text
$default mixed The default value (must be null for InputOption::VALUE_NONE)
Результат Command The current instance
    public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
    {
        $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
        return $this;
    }

Usage Example

Пример #1
0
 public static function configureTargetConnectionOptions(BaseCommand $command)
 {
     $command->addOption('target-host', null, InputArgument::OPTIONAL, 'Neo4j source server hostname');
     $command->addOption('target-port', null, InputArgument::OPTIONAL, 'Neo4j source server port');
     $command->addOption('target-user', null, InputArgument::OPTIONAL, 'Neo4j source server username');
     $command->addOption('target-password', null, InputArgument::OPTIONAL, 'Neo4j source server password');
 }
All Usage Examples Of Symfony\Component\Console\Command\Command::addOption