private function Parser::parseValue in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/yaml/Parser.php \Symfony\Component\Yaml\Parser::parseValue()
Parses a YAML value.
Parameters
string $value A YAML value:
bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise:
bool $objectSupport True if object support is enabled, false otherwise:
bool $objectForMap true if maps should return a stdClass instead of array():
Return value
mixed A PHP value
Throws
ParseException When reference does not exist
1 call to Parser::parseValue()
- Parser::parse in vendor/
symfony/ yaml/ Parser.php - Parses a YAML string to a PHP value.
File
- vendor/
symfony/ yaml/ Parser.php, line 453
Class
- Parser
- Parser parses YAML strings to convert them to PHP arrays.
Namespace
Symfony\Component\YamlCode
private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $objectForMap) {
if (0 === strpos($value, '*')) {
if (false !== ($pos = strpos($value, '#'))) {
$value = substr($value, 1, $pos - 2);
}
else {
$value = substr($value, 1);
}
if (!array_key_exists($value, $this->refs)) {
throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLine);
}
return $this->refs[$value];
}
if (preg_match('/^' . self::BLOCK_SCALAR_HEADER_PATTERN . '$/', $value, $matches)) {
$modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
return $this
->parseBlockScalar($matches['separator'], preg_replace('#\\d+#', '', $modifiers), (int) abs($modifiers));
}
try {
return Inline::parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
} catch (ParseException $e) {
$e
->setParsedLine($this
->getRealCurrentLineNb() + 1);
$e
->setSnippet($this->currentLine);
throw $e;
}
}