private static function Inline::parseQuotedScalar in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/Yaml/Inline.php \Symfony\Component\Yaml\Inline::parseQuotedScalar()
Parses a quoted scalar to YAML.
Parameters
string $scalar:
int &$i:
Return value
string A YAML string
Throws
ParseException When malformed inline YAML string is parsed
1 call to Inline::parseQuotedScalar()
- Inline::parseScalar in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ Yaml/ Inline.php - Parses a scalar to a YAML string.
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ Yaml/ Inline.php, line 255
Class
- Inline
- Inline implements a YAML parser/dumper for the YAML inline syntax.
Namespace
Symfony\Component\YamlCode
private static function parseQuotedScalar($scalar, &$i) {
if (!preg_match('/' . self::REGEX_QUOTED_STRING . '/Au', substr($scalar, $i), $match)) {
throw new ParseException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i)));
}
$output = substr($match[0], 1, strlen($match[0]) - 2);
$unescaper = new Unescaper();
if ('"' == $scalar[$i]) {
$output = $unescaper
->unescapeDoubleQuotedString($output);
}
else {
$output = $unescaper
->unescapeSingleQuotedString($output);
}
$i += strlen($match[0]);
return $output;
}