private function resolvePointer(stdClass $schema, Uri $pointerUri)
    {
        $segments = $pointerUri->getPointerSegments();
        $pointer = $pointerUri->getRawPointer();
        $currentNode = $schema;

        for ($i = 0, $max = count($segments); $i < $max; ++$i) {
            if (is_object($currentNode)) {
                if (property_exists($currentNode, $segments[$i])) {
                    $currentNode = $currentNode->{$segments[$i]};
                    continue;
                }

                throw new UnresolvedPointerPropertyException([$segments[$i], $i, $pointer]);
            }

            if (is_array($currentNode)) {
                if (!preg_match('/^\d+$/', $segments[$i])) {
                    throw new InvalidPointerIndexException([$segments[$i], $i, $pointer]);
                }

                if (!isset($currentNode[$index = (int) $segments[$i]])) {
                    throw new UnresolvedPointerIndexException([$segments[$i], $i, $pointer]);
                }

                $currentNode = $currentNode[$index];
                continue;
            }

            throw new InvalidSegmentTypeException([$i, $pointer]);
        }

        return $currentNode;
    }
private function resolvePointer(stdClass $schema, Uri $pointerUri)
    {
        $segments = $pointerUri->getPointerSegments();
        $pointer = $pointerUri->getRawPointer();
        $currentNode = $schema;

        for ($i = 0, $max = count($segments); $i < $max; ++$i) {
            if (is_object($currentNode)) {
                if (property_exists($currentNode, $segments[$i])) {
                    $currentNode = $currentNode->{$segments[$i]};
                    continue;
                }

                throw new UnresolvedPointerPropertyException([$segments[$i], $i, $pointer]);
            }

            if (is_array($currentNode)) {
                if (!preg_match('/^\d+$/', $segments[$i])) {
                    throw new InvalidPointerIndexException([$segments[$i], $i, $pointer]);
                }

                if (!isset($currentNode[$index = (int) $segments[$i]])) {
                    throw new UnresolvedPointerIndexException([$segments[$i], $i, $pointer]);
                }

                $currentNode = $currentNode[$index];
                continue;
            }

            throw new InvalidSegmentTypeException([$i, $pointer]);
        }

        return $currentNode;
    }
private function resolvePointer ( stdClass $ schema , Uri $ pointerUri ) { $ segments = $ pointerUri -> getPointerSegments ( ) ; $ pointer = $ pointerUri -> getRawPointer ( ) ; $ currentNode = $ schema ; for ( $ i = 0 , $ max = count ( $ segments ) ; $ i < $ max ; ++ $ i ) { if ( is_object ( $ currentNode ) ) { if ( property_exists ( $ currentNode , $ segments [ $ i ] ) ) { $ currentNode = $ currentNode -> { $ segments [ $ i ] } ; continue ; } throw new UnresolvedPointerPropertyException ( [ $ segments [ $ i ] , $ i , $ pointer ] ) ; } if ( is_array ( $ currentNode ) ) { if ( ! preg_match ( '/^\d+$/' , $ segments [ $ i ] ) ) { throw new InvalidPointerIndexException ( [ $ segments [ $ i ] , $ i , $ pointer ] ) ; } if ( ! isset ( $ currentNode [ $ index = ( int ) $ segments [ $ i ] ] ) ) { throw new UnresolvedPointerIndexException ( [ $ segments [ $ i ] , $ i , $ pointer ] ) ; } $ currentNode = $ currentNode [ $ index ] ; continue ; } throw new InvalidSegmentTypeException ( [ $ i , $ pointer ] ) ; } return $ currentNode ; }
Resolves a JSON pointer according to RFC 6901.

@param stdClass $schema
@param Uri      $pointerUri

@return mixed

@throws InvalidPointerIndexException
@throws InvalidSegmentTypeException
@throws UnresolvedPointerIndexException
@throws UnresolvedPointerPropertyException
Resolves a JSON pointer according to RFC 6901 .