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

Breadcrumb

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

function Inline::parseQuotedScalar

Parses a YAML quoted scalar.

Throws

ParseException When malformed inline YAML string is parsed

2 calls to Inline::parseQuotedScalar()
Inline::evaluateScalar in vendor/symfony/yaml/Inline.php
Evaluates scalars and replaces magic values.
Inline::parseScalar in vendor/symfony/yaml/Inline.php
Parses a YAML scalar.

File

vendor/symfony/yaml/Inline.php, line 324

Class

Inline
Inline implements a YAML parser/dumper for the YAML inline syntax.

Namespace

Symfony\Component\Yaml

Code

private static function parseQuotedScalar(string $scalar, int &$i = 0) : string {
    if (!Parser::preg_match('/' . self::REGEX_QUOTED_STRING . '/Au', substr($scalar, $i), $match)) {
        throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
    }
    $output = substr($match[0], 1, -1);
    $unescaper = new Unescaper();
    if ('"' == $scalar[$i]) {
        $output = $unescaper->unescapeDoubleQuotedString($output);
    }
    else {
        $output = $unescaper->unescapeSingleQuotedString($output);
    }
    $i += \strlen($match[0]);
    return $output;
}

API Navigation

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