src/POData/UriProcessor/ResourcePathProcessor/SegmentParser/SegmentParser.php
/**
     * Process a collection of OData URI segment strings and turn them into segment descriptors
     * 
     * @param string[] $segments array of segments strings to parse
     * @param boolean $checkRights Whether to check for rights or not
     * 
     * @throws ODataException Exception in case of any error found while precessing segments
     */
Process a collection of OData URI segment strings and turn them into segment descriptors

@param string[] $segments array of segments strings to parse
@param boolean $checkRights Whether to check for rights or not

@throws ODataException Exception in case of any error found while precessing segments
Process a collection of OData URI segment strings and turn them into segment descriptors @param string [] $segments array of segments strings to parse @param boolean $checkRights Whether to check for rights or not @throws ODataException Exception in case of any error found while precessing segments
private function createSegmentDescriptors($segments, $checkRights)
    {        
        if (empty($segments)) {
	        $descriptor = new SegmentDescriptor();
	        $descriptor->setTargetKind(TargetKind::SERVICE_DIRECTORY());
            $this->_segmentDescriptors[] = $descriptor;
            return;
        }
        $segmentCount = count($segments);
        $identifier = $keyPredicate = null;
        $this->extractSegmentIdentifierAndKeyPredicate($segments[0], $identifier, $keyPredicate);
	    $previous = $this->_createFirstSegmentDescriptor(
            $identifier, $keyPredicate, $checkRights
        );
        $this->_segmentDescriptors[0] = $previous;
        for ($i = 1; $i < $segmentCount; $i++) {
	        $current = $this->createNextSegment($previous, $segments[$i], $checkRights);
            $current->setPrevious($previous);
            $previous->setNext($current);
            $this->_segmentDescriptors[] = $current;
            $previous = $current;
        }
        if ($previous->getTargetKind() == TargetKind::LINK()) {
			throw ODataException::createBadRequestError(Messages::segmentParserMissingSegmentAfterLink());
        }
    }
private function createSegmentDescriptors ( $ segments , $ checkRights ) { if ( empty ( $ segments ) ) { $ descriptor = new SegmentDescriptor ( ) ; $ descriptor -> setTargetKind ( TargetKind :: SERVICE_DIRECTORY ( ) ) ; $ this -> _segmentDescriptors [ ] = $ descriptor ; return ; } $ segmentCount = count ( $ segments ) ; $ identifier = $ keyPredicate = null ; $ this -> extractSegmentIdentifierAndKeyPredicate ( $ segments [ 0 ] , $ identifier , $ keyPredicate ) ; $ previous = $ this -> _createFirstSegmentDescriptor ( $ identifier , $ keyPredicate , $ checkRights ) ; $ this -> _segmentDescriptors [ 0 ] = $ previous ; for ( $ i = 1 ; $ i < $ segmentCount ; $ i ++ ) { $ current = $ this -> createNextSegment ( $ previous , $ segments [ $ i ] , $ checkRights ) ; $ current -> setPrevious ( $ previous ) ; $ previous -> setNext ( $ current ) ; $ this -> _segmentDescriptors [ ] = $ current ; $ previous = $ current ; } if ( $ previous -> getTargetKind ( ) == TargetKind :: LINK ( ) ) { throw ODataException :: createBadRequestError ( Messages :: segmentParserMissingSegmentAfterLink ( ) ) ; } }
Process a collection of OData URI segment strings and turn them into segment descriptors
Process a collection of OData URI segment strings and turn them into segment descriptors
//If there's no segments, then it's the service root //At this point $previous is the final segment..which cannot be a $link