Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Unescaper.php

function Unescaper::unescapeCharacter

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

Parameters

string $value An escaped 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 59

Class

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

Namespace

Symfony\Component\Yaml

Code

private function unescapeCharacter(string $value) : string {
    return match ($value[1]) {    '0' => "\x00",
        'a' => "\x07",
        'b' => "\x08",
        't' => "\t",
        "\t" => "\t",
        'n' => "\n",
        'v' => "\v",
        'f' => "\f",
        'r' => "\r",
        'e' => "\x1b",
        ' ' => ' ',
        '"' => '"',
        '/' => '/',
        '\\' => '\\',
        'N' => "…",
        '_' => " ",
        'L' => "
",
        'P' => "
",
        'x' => self::utf8chr(hexdec(substr($value, 2, 2))),
        'u' => self::utf8chr(hexdec(substr($value, 2, 4))),
        'U' => self::utf8chr(hexdec(substr($value, 2, 8))),
        default => throw new ParseException(\sprintf('Found unknown escape character "%s".', $value)),
    
    };
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal