You are here

private function Unescaper::unescapeCharacter in Lockr 7.3

Unescapes a character that was found in a double-quoted string.

Parameters

string $value An escaped character:

Return value

string The unescaped character

1 call to Unescaper::unescapeCharacter()
Unescaper::unescapeDoubleQuotedString in vendor/symfony/yaml/Unescaper.php
Unescapes a double quoted string.

File

vendor/symfony/yaml/Unescaper.php, line 67

Class

Unescaper
Unescaper encapsulates unescaping rules for single and double-quoted YAML strings.

Namespace

Symfony\Component\Yaml

Code

private function unescapeCharacter($value) {
  switch ($value[1]) {
    case '0':
      return "\0";
    case 'a':
      return "\7";
    case 'b':
      return "\10";
    case 't':
      return "\t";
    case "\t":
      return "\t";
    case 'n':
      return "\n";
    case 'v':
      return "\v";
    case 'f':
      return "\f";
    case 'r':
      return "\r";
    case 'e':
      return "\33";
    case ' ':
      return ' ';
    case '"':
      return '"';
    case '/':
      return '/';
    case '\\':
      return '\\';
    case 'N':

      // U+0085 NEXT LINE
      return "…";
    case '_':

      // U+00A0 NO-BREAK SPACE
      return " ";
    case 'L':

      // U+2028 LINE SEPARATOR
      return "
";
    case 'P':

      // U+2029 PARAGRAPH SEPARATOR
      return "
";
    case 'x':
      return self::utf8chr(hexdec(substr($value, 2, 2)));
    case 'u':
      return self::utf8chr(hexdec(substr($value, 2, 4)));
    case 'U':
      return self::utf8chr(hexdec(substr($value, 2, 8)));
    default:
      throw new ParseException(sprintf('Found unknown escape character "%s".', $value));
  }
}