/** * */ public function testParse() { $arr = array('-a', '-b=foo', '-c', 'bar', '--export', '--foo=bar', '-xyz', '-=asd', 'bluff', 'inva--lid', '--test', 'value', '-q', 'woho'); $this->object->parse($arr); $this->assertTrue($this->object->getValue('-a')); $this->assertEquals('foo', $this->object->getValue('-b')); $this->assertEquals('bar', $this->object->getValue('-c')); $this->assertTrue($this->object->getValue('--export')); $this->assertEquals('bar', $this->object->getValue('--foo')); $this->assertTrue($this->object->getValue('-x')); $this->assertTrue($this->object->getValue('-y')); $this->assertTrue($this->object->getValue('-z')); }
/** * Overrides base class, takes aliases into account * * @param string $flag * * @return string|bool Returns the value of the flag, string or bool according to the flag */ public function getValue($flag) { $f = $this->getFlag($flag); if ($f) { if (array_key_exists($flag, $this->flags)) { return parent::getValue($f->getName()); } } return false; }