You are here

public function Unescaper::unescapeCharacter in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php \Symfony\Component\Yaml\Unescaper::unescapeCharacter()

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

@internal This method is public to be usable as callback. It should not be used in user code. Should be changed in 3.0.

Parameters

string $value An escaped character:

Return value

string The unescaped character

File

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

Class

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

Namespace

Symfony\Component\Yaml

Code

public 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:
      @trigger_error('Not escaping a backslash in a double-quoted string is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', E_USER_DEPRECATED);
      return $value;
  }
}