当前位置: 首页>>代码示例>>PHP>>正文


PHP Cli::getValue方法代码示例

本文整理汇总了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'));
 }
开发者ID:rgantt,项目名称:wsdl2phpgenerator,代码行数:15,代码来源:CliTest.php

示例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;
开发者ID:rgantt,项目名称:wsdl2phpgenerator,代码行数:31,代码来源:generate.php


注:本文中的Cli::getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。