示例#1
0
 /**
  * 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
0
$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;