/**
  * Tests whether removeByKey() works as expected.
  *
  * @return void
  */
 public function testRemoveByKey()
 {
     $keyValueSet = new CaseInsensitiveKeysMap(array('a' => 'a', 'b' => 'b', 'C' => 'C'));
     $keyValueSet->removeByKey('A');
     $this->assertNull($keyValueSet->get('a'));
     $keyValueSet->removeByKey('C');
     $this->assertNull($keyValueSet->get('C'));
 }
Exemplo n.º 2
0
 /**
  * Returns the value of the argument with the given name.
  *
  * Throws an exception in case no argument exists with the given name.
  *
  * @param string $argumentName Name of the argument to return the value of
  * @param bool $dequote Whether to remove surrounding quotes from the argument value
  * @throws \Ableron\Core\Exception\SystemException
  * @return string|int
  */
 public function getArgument($argumentName, $dequote = true)
 {
     // check whether argument exists
     if (!$this->arguments->containsKey($argumentName)) {
         throw new SystemException(sprintf('Unable to read argument "%s" of tag "{%s}" - Tag does not contain requested argument!', $argumentName, $this->getTagDeclaration()), 0, E_USER_ERROR, __FILE__, __LINE__);
     }
     // read value of the requested argument
     $argument = $this->arguments->get($argumentName);
     // return the requested argument
     return $dequote && is_string($argument) ? StringUtil::dequote($argument) : $argument;
 }