本文整理汇总了PHP中Symfony\Component\Console\Input\InputDefinition::addOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP InputDefinition::addOptions方法的具体用法?PHP InputDefinition::addOptions怎么用?PHP InputDefinition::addOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Input\InputDefinition
的用法示例。
在下文中一共展示了InputDefinition::addOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setGlobalInput
protected function setGlobalInput()
{
$inputDefinition = new InputDefinition();
$inputDefinition->addOptions(array(new InputOption('system_path', null, InputOption::VALUE_OPTIONAL, 'The path to your system folder', null), new InputOption('http_host', null, InputOption::VALUE_OPTIONAL, 'The HTTP_HOST to spoof in $_SERVER', null), new InputOption('document_root', null, InputOption::VALUE_OPTIONAL, 'The DOCUMENT_ROOT to spoof in $_SERVER', null), new InputOption('request_uri', null, InputOption::VALUE_OPTIONAL, 'The REQUEST_URI to spoof in $_SERVER', null), new InputOption('remote_addr', null, InputOption::VALUE_OPTIONAL, 'The REMOTE_ADDR to spoof in $_SERVER', null), new InputOption('user_agent', null, InputOption::VALUE_OPTIONAL, 'The HTTP_USER_AGENT to spoof in $_SERVER', null)));
$this->globalInput = new GlobalArgvInput(null, true);
$this->globalInput->bind($inputDefinition);
}
示例2: testAddOptions
public function testAddOptions()
{
$this->initializeOptions();
$definition = new InputDefinition(array($this->foo));
$this->assertEquals(array('foo' => $this->foo), $definition->getOptions(), '->addOptions() adds an array of InputOption objects');
$definition->addOptions(array($this->bar));
$this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getOptions(), '->addOptions() does not clear existing InputOption objects');
}