本文整理汇总了PHP中Cli::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Cli::getValue方法的具体用法?PHP Cli::getValue怎么用?PHP Cli::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cli
的用法示例。
在下文中一共展示了Cli::getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetValue
/**
* Tests the whole getValue function, implicitly tests the getFlag function too
*/
public function testGetValue()
{
$this->object->addFlag('-f', 'test', true, true);
$this->object->addFlag('-g', 'test', true, false);
$this->object->addAlias('-f', '--bar');
$this->object->validate(array('-f=foo', '--bar', 'foo'));
$this->assertEquals('foo', $this->object->getValue('-f'));
$this->assertEquals('foo', $this->object->getValue('--bar'));
$this->assertEquals(false, $this->object->getValue('-g'));
$this->assertEquals(false, $this->object->getValue('--invalidFlag'));
$this->assertNotEquals(false, $this->object->getValue('-f'));
}
示例2: trim
$cli->addAlias('-e', '--exists');
$cli->addAlias('-t', '--noTypeConstructor');
$cli->addAlias('-s', '--singleFile');
$cli->addAlias('-v', '--verbose');
$cli->addAlias('-i', '--input');
$cli->addAlias('-o', '--output');
$cli->addAlias('-n', '--namespace');
$cli->addAlias('-c', '--classes');
$cli->addAlias('-c', '--classNames');
$cli->addAlias('-c', '--classList');
$cli->addAlias('-p', '--prefix');
$cli->addAlias('-q', '--suffix');
$cli->addAlias('-h', '--help');
$cli->addAlias('-h', '--h');
$cli->validate($argv);
$singleFile = $cli->getValue('-s');
$classNames = trim($cli->getValue('-c'));
if ($singleFile && strlen($classNames) > 0) {
// Print different messages based on if more than one class is requested for generation
if (strpos($classNames, ',') !== false) {
print printf(_('You have selected to only generate some of the classes in the wsdl(%s) and to save them in one file. Continue? [Y/n]'), $classNames) . PHP_EOL;
} else {
print _('You have selected to only generate one class and save it to a single file. If you have selected the service class and outputs this file to a directory where you previosly have generated the classes the file will be overwritten. Continue? [Y/n]') . PHP_EOL;
}
//TODO: Refactor this to cli class?
// Force the user to supply a valid input
while (true) {
$cmd = readline(null);
// Reads from the standard input
if (in_array($cmd, array('', 'y', 'Y', 'yes'))) {
break;