public function Parser::parse in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php \Symfony\Component\Yaml\Parser::parse()
Parses a YAML string to a PHP value.
Parameters
string $value A YAML string:
bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), 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 If the YAML is not valid
File
- vendor/
symfony/ yaml/ Parser.php, line 60
Class
- Parser
- Parser parses YAML strings to convert them to PHP arrays.
Namespace
Symfony\Component\YamlCode
public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false) {
if (false === preg_match('//u', $value)) {
throw new ParseException('The YAML value does not appear to be valid UTF-8.');
}
$this->refs = array();
$mbEncoding = null;
$e = null;
$data = null;
if (2 & (int) ini_get('mbstring.func_overload')) {
$mbEncoding = mb_internal_encoding();
mb_internal_encoding('UTF-8');
}
try {
$data = $this
->doParse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap);
} catch (\Exception $e) {
} catch (\Throwable $e) {
}
if (null !== $mbEncoding) {
mb_internal_encoding($mbEncoding);
}
$this->lines = array();
$this->currentLine = '';
$this->refs = array();
$this->skippedLineNumbers = array();
$this->locallySkippedLineNumbers = array();
if (null !== $e) {
throw $e;
}
return $data;
}