Code Duplication    Length = 13-28 lines in 2 locations

src/POData/ObjectModel/ObjectModelSerializerBase.php 1 location

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

src/POData/UriProcessor/UriProcessor.php 1 location

@@ 927-939 (lines=13) @@
924
     *
925
     * @return bool true if the segment was push, false otherwise
926
     */
927
    private function _pushSegment($segmentName, ResourceSetWrapper &$resourceSetWrapper)
928
    {
929
        $rootProjectionNode = $this->request->getRootProjectionNode();
930
        if (!is_null($rootProjectionNode)
931
            && $rootProjectionNode->isExpansionSpecified()
932
        ) {
933
            array_push($this->_segmentNames, $segmentName);
934
            array_push($this->_segmentResourceSetWrappers, $resourceSetWrapper);
935
            return true;
936
        }
937
938
        return false;
939
    }
940
941
    /**
942
     * Pops segment information from the 'Segment Stack'