Code Duplication    Length = 12-13 lines in 2 locations

src/POData/ObjectModel/ObjectModelSerializerBase.php 1 location

@@ 572-583 (lines=12) @@
569
     *
570
     * @throws InvalidOperationException If found un-balanced call with _pushSegment
571
     */
572
    protected function popSegment($needPop)
573
    {
574
        if ($needPop) {
575
            if (!empty($this->_segmentNames)) {
576
                array_pop($this->_segmentNames);
577
                array_pop($this->_segmentResourceSetWrappers);
578
                array_pop($this->_segmentResultCounts);
579
            } else {
580
                throw new InvalidOperationException('Found non-balanced call to _pushSegment and popSegment');
581
            }
582
        }
583
    }
584
585
    /**
586
     * Recursive metod to build $expand and $select paths for a specified node.

src/POData/UriProcessor/UriProcessor.php 1 location

@@ 954-966 (lines=13) @@
951
     * @throws InvalidOperationException If found un-balanced call
952
     *                                   with _pushSegment
953
     */
954
    private function _popSegment($needPop)
955
    {
956
        if ($needPop) {
957
            if (!empty($this->_segmentNames)) {
958
                array_pop($this->_segmentNames);
959
                array_pop($this->_segmentResourceSetWrappers);
960
            } else {
961
                throw new InvalidOperationException(
962
                    'Found non-balanced call to _pushSegment and popSegment'
963
                );
964
            }
965
        }
966
    }
967
968
    /**
969
     * Assert that the given condition is true.