本文整理汇总了PHP中Cake\Console\ConsoleOptionParser::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ConsoleOptionParser::toArray方法的具体用法?PHP ConsoleOptionParser::toArray怎么用?PHP ConsoleOptionParser::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Console\ConsoleOptionParser
的用法示例。
在下文中一共展示了ConsoleOptionParser::toArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMerge
/**
* Tests merge()
*
* @return void
*/
public function testMerge()
{
$parser = new ConsoleOptionParser('test');
$parser->addOption('test', ['short' => 't', 'boolean' => true])->addArgument('one', ['required' => true, 'choices' => ['a', 'b']])->addArgument('two', ['required' => true]);
$parserTwo = new ConsoleOptionParser('test');
$parserTwo->addOption('file', ['short' => 'f', 'boolean' => true])->addOption('output', ['short' => 'o', 'boolean' => true])->addArgument('one', ['required' => true, 'choices' => ['a', 'b']]);
$parser->merge($parserTwo);
$result = $parser->toArray();
$options = $result['options'];
$this->assertTrue(isset($options['quiet']));
$this->assertTrue(isset($options['test']));
$this->assertTrue(isset($options['file']));
$this->assertTrue(isset($options['output']));
$this->assertEquals(2, count($result['arguments']));
$this->assertEquals(6, count($result['options']));
}