protected function getNestedValue($root, $path)
    {
        $node = &$root;

        $segments = explode($this->separator, $path);

        $last = count($segments) - 1;

        for ($i = 0; $i <= $last; ++$i) {
            $node = @$this->getNode($node, $segments[$i]);

            if ($node === null) {
                return null;
            }

            if (!is_scalar($node)) {
                continue;
            }

            if ($i == $last) {
                return $node;
            }

            return null;
        }

        return null;
    }