Code Duplication    Length = 14-29 lines in 2 locations

src/POData/ObjectModel/ObjectModelSerializerBase.php 1 location

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

src/POData/UriProcessor/UriProcessor.php 1 location

@@ 796-809 (lines=14) @@
793
     *
794
     * @return bool true if the segment was push, false otherwise
795
     */
796
    private function _pushSegment($segmentName, ResourceSetWrapper & $resourceSetWrapper)
797
    {
798
        $rootProjectionNode = $this->request->getRootProjectionNode();
799
        if (!is_null($rootProjectionNode)
800
            && $rootProjectionNode->isExpansionSpecified()
801
        ) {
802
            array_push($this->_segmentNames, $segmentName);
803
            array_push($this->_segmentResourceSetWrappers, $resourceSetWrapper);
804
805
            return true;
806
        }
807
808
        return false;
809
    }
810
811
    /**
812
     * Pops segment information from the 'Segment Stack'