private function traverse($pointer)
    {
        $parsedPointer = $this->parse($pointer);
        $json    = $this->json;

        foreach ($parsedPointer as $segment) {
            if ($json instanceof Reference) {
                if (!$json->has($segment)) {
                    return new NonExistentValue($segment, $pointer);
                }
                $json = $json->get($segment);
            } elseif (is_object($json)) {
                // who does this?
                if ($segment === '' && property_exists($json, '_empty_')) {
                    $segment = '_empty_';
                }
                if (!property_exists($json, $segment)) {
                    return new NonExistentValue($segment, $pointer);
                }
                $json = $json->$segment;
            } elseif (is_array($json)) {
                if (!array_key_exists($segment, $json)) {
                    return new NonExistentValue($segment, $pointer);
                }
                $json = $json[$segment];
            } else {
                return new NonExistentValue($segment, $pointer);
            }
        }

        return $json;
    }
private function traverse($pointer)
    {
        $parsedPointer = $this->parse($pointer);
        $json    = $this->json;

        foreach ($parsedPointer as $segment) {
            if ($json instanceof Reference) {
                if (!$json->has($segment)) {
                    return new NonExistentValue($segment, $pointer);
                }
                $json = $json->get($segment);
            } elseif (is_object($json)) {
                // who does this?
                if ($segment === '' && property_exists($json, '_empty_')) {
                    $segment = '_empty_';
                }
                if (!property_exists($json, $segment)) {
                    return new NonExistentValue($segment, $pointer);
                }
                $json = $json->$segment;
            } elseif (is_array($json)) {
                if (!array_key_exists($segment, $json)) {
                    return new NonExistentValue($segment, $pointer);
                }
                $json = $json[$segment];
            } else {
                return new NonExistentValue($segment, $pointer);
            }
        }

        return $json;
    }
private function traverse ( $ pointer ) { $ parsedPointer = $ this -> parse ( $ pointer ) ; $ json = $ this -> json ; foreach ( $ parsedPointer as $ segment ) { if ( $ json instanceof Reference ) { if ( ! $ json -> has ( $ segment ) ) { return new NonExistentValue ( $ segment , $ pointer ) ; } $ json = $ json -> get ( $ segment ) ; } elseif ( is_object ( $ json ) ) { // who does this? if ( $ segment === '' && property_exists ( $ json , '_empty_' ) ) { $ segment = '_empty_' ; } if ( ! property_exists ( $ json , $ segment ) ) { return new NonExistentValue ( $ segment , $ pointer ) ; } $ json = $ json -> $ segment ; } elseif ( is_array ( $ json ) ) { if ( ! array_key_exists ( $ segment , $ json ) ) { return new NonExistentValue ( $ segment , $ pointer ) ; } $ json = $ json [ $ segment ] ; } else { return new NonExistentValue ( $ segment , $ pointer ) ; } } return $ json ; }
Returns the value referenced by the pointer or a NonExistentValue if the value does not exist.

@param string $pointer The pointer

@return mixed
Returns the value referenced by the pointer or a NonExistentValue if the value does not exist .