Code Duplication    Length = 13-28 lines in 2 locations

src/POData/ObjectModel/ObjectModelSerializerBase.php 1 location

@@ 386-413 (lines=28) @@
383
     * 
384
     * @return bool true if the segment was push, false otherwise
385
     */
386
    private function _pushSegment($segmentName, ResourceSetWrapper &$resourceSetWrapper)
387
    {
388
        $rootProjectionNode = $this->request->getRootProjectionNode();
389
        // Even though there is no expand in the request URI, still we need to push
390
        // the segment information if we need to count 
391
        //the number of entities written.
392
        // After serializing each entity we should check the count to see whether  
393
        // we serialized more entities than configured 
394
        //(page size, maxResultPerCollection).
395
        // But we will not do this check since library is doing paging and never 
396
        // accumulate entities more than configured.
397
        //
398
        // if ((!is_null($rootProjectionNode) && $rootProjectionNode->isExpansionSpecified()) 
399
        //    || ($resourceSetWrapper->getResourceSetPageSize() != 0)
400
        //    || ($this->service->getServiceConfiguration()->getMaxResultsPerCollection() != PHP_INT_MAX)
401
        //) {}
402
403
        if (!is_null($rootProjectionNode) 
404
            && $rootProjectionNode->isExpansionSpecified()
405
        ) {
406
            array_push($this->_segmentNames, $segmentName);
407
            array_push($this->_segmentResourceSetWrappers, $resourceSetWrapper);
408
            array_push($this->_segmentResultCounts, 0);
409
            return true;
410
        }
411
412
        return false;
413
    }
414
415
    /**
416
     * Get next page link from the given entity instance.

src/POData/UriProcessor/UriProcessor.php 1 location

@@ 672-684 (lines=13) @@
669
     *
670
     * @return bool true if the segment was push, false otherwise
671
     */
672
    private function _pushSegment($segmentName, ResourceSetWrapper &$resourceSetWrapper)
673
    {
674
        $rootProjectionNode = $this->request->getRootProjectionNode();
675
        if (!is_null($rootProjectionNode) 
676
            && $rootProjectionNode->isExpansionSpecified()
677
        ) {
678
            array_push($this->_segmentNames, $segmentName);
679
            array_push($this->_segmentResourceSetWrappers, $resourceSetWrapper);
680
            return true;
681
        }
682
683
        return false;
684
    }
685
686
    /**
687
     * Pops segment information from the 'Segment Stack'