You are here

private function Parser::getLineTag in Lockr 7.3

1 call to Parser::getLineTag()
Parser::doParse in vendor/symfony/yaml/Parser.php

File

vendor/symfony/yaml/Parser.php, line 1102

Class

Parser
Parser parses YAML strings to convert them to PHP arrays.

Namespace

Symfony\Component\Yaml

Code

private function getLineTag($value, $flags, $nextLineCheck = true) {
  if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^' . self::TAG_PATTERN . ' *( +#.*)?$/', $value, $matches)) {
    return;
  }
  if ($nextLineCheck && !$this
    ->isNextLineIndented()) {
    return;
  }
  $tag = substr($matches['tag'], 1);

  // Built-in tags
  if ($tag && '!' === $tag[0]) {
    throw new ParseException(sprintf('The built-in tag "!%s" is not implemented.', $tag), $this
      ->getRealCurrentLineNb() + 1, $value, $this->filename);
  }
  if (Yaml::PARSE_CUSTOM_TAGS & $flags) {
    return $tag;
  }
  throw new ParseException(sprintf('Tags support is not enabled. You must use the flag `Yaml::PARSE_CUSTOM_TAGS` to use "%s".', $matches['tag']), $this
    ->getRealCurrentLineNb() + 1, $value, $this->filename);
}