You are here

public function Unescaper::unescapeCharacter in Loft Data Grids 6.2

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

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

Parameters

string $value An escaped character:

Return value

string The unescaped character

File

vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php, line 68

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)));
  }
}