Exemplo n.º 1
0
 /**
  * Normalizes the given token.
  *
  * If $tokenIsParameterValue equals to FALSE, the given token is expected to
  * be a primary type, a sub type or a parameter name.
  *
  * @param string $token The token to normalize
  * @param bool $tokenIsParameterValue Whether the given token is a parameter value
  * @return string
  */
 public static function normalizeToken($token, $tokenIsParameterValue = false)
 {
     return $tokenIsParameterValue ? StringUtil::dequote(self::stripComments($token)) : StringUtil::toLowerCase(self::stripComments($token));
 }
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;
 }