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

@@ 815-828 (lines=14) @@
812
     *
813
     * @return bool true if the segment was push, false otherwise
814
     */
815
    private function _pushSegment($segmentName, ResourceSetWrapper &$resourceSetWrapper)
816
    {
817
        $rootProjectionNode = $this->request->getRootProjectionNode();
818
        if (!is_null($rootProjectionNode)
819
            && $rootProjectionNode->isExpansionSpecified()
820
        ) {
821
            array_push($this->_segmentNames, $segmentName);
822
            array_push($this->_segmentResourceSetWrappers, $resourceSetWrapper);
823
824
            return true;
825
        }
826
827
        return false;
828
    }
829
830
    /**
831
     * Pops segment information from the 'Segment Stack'