Code Duplication    Length = 12-13 lines in 2 locations

src/POData/ObjectModel/ObjectModelSerializerBase.php 1 location

@@ 588-599 (lines=12) @@
585
     *
586
     * @throws InvalidOperationException If found un-balanced call with _pushSegment
587
     */
588
    protected function popSegment($needPop)
589
    {
590
        if ($needPop) {
591
            if (!empty($this->_segmentNames)) {
592
                array_pop($this->_segmentNames);
593
                array_pop($this->_segmentResourceSetWrappers);
594
                array_pop($this->_segmentResultCounts);
595
            } else {
596
                throw new InvalidOperationException('Found non-balanced call to _pushSegment and popSegment');
597
            }
598
        }
599
    }
600
601
    /**
602
     * Recursive metod to build $expand and $select paths for a specified node.

src/POData/UriProcessor/UriProcessor.php 1 location

@@ 841-853 (lines=13) @@
838
     * @throws InvalidOperationException If found un-balanced call
839
     *                                   with _pushSegment
840
     */
841
    private function _popSegment($needPop)
842
    {
843
        if ($needPop) {
844
            if (!empty($this->_segmentNames)) {
845
                array_pop($this->_segmentNames);
846
                array_pop($this->_segmentResourceSetWrappers);
847
            } else {
848
                throw new InvalidOperationException(
849
                    'Found non-balanced call to _pushSegment and popSegment'
850
                );
851
            }
852
        }
853
    }
854
855
    /**
856
     * Assert that the given condition is true.