YamlParser::parseValue PHP Method

parseValue() protected method

Parses a YAML value.
protected parseValue ( $value ) : mixed
return mixed A PHP value
    protected function parseValue($value)
    {
        if ('*' === substr($value, 0, 1)) {
            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 InvalidArgumentException(sprintf('Reference "%s" does not exist (%s).', $value, $this->currentLine));
            }
            return $this->refs[$value];
        }
        if (preg_match('/^(?P<separator>\\||>)(?P<modifiers>\\+|\\-|\\d+|\\+\\d+|\\-\\d+|\\d+\\+|\\d+\\-)?(?P<comments> +#.*)?$/', $value, $matches)) {
            $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
            return $this->parseFoldedScalar($matches['separator'], preg_replace('#\\d+#', '', $modifiers), intval(abs($modifiers)));
        } else {
            return YamlInline::load($value);
        }
    }