/** * import events * * @param Zend_Console_Getopt $_opts */ public function import($_opts) { //If old param is used add the new one foreach ($_opts->getRemainingArgs() as $key => $opt) { if (strpos($opt, 'importContainerId=') !== false) { $_opts->addArguments(array('container_id=' . substr($opt, 18, strlen($opt)))); } } parent::_import($_opts); }
public function testGetoptAddArguments() { $opts = new Zend_Console_Getopt('abp:', array('-a')); $this->assertNull(@$opts->p); $opts->addArguments(array('-p', 'p_arg')); $this->assertEquals($opts->p, 'p_arg'); }
private function _parseParams($context, $argv) { $opts = new Zend_Console_Getopt(); $aliases = array(); foreach ($context->attribute as $attribute) { // Key should be the rule string, value is the long usage $opts->addRules(array($attribute->getopt, $attribute->usage)); } $opts->addArguments($argv); return $opts->parse(); }