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

@@ 820-832 (lines=13) @@
817
     * @throws InvalidOperationException If found un-balanced call
818
     *                                   with _pushSegment
819
     */
820
    private function _popSegment($needPop)
821
    {
822
        if ($needPop) {
823
            if (!empty($this->_segmentNames)) {
824
                array_pop($this->_segmentNames);
825
                array_pop($this->_segmentResourceSetWrappers);
826
            } else {
827
                throw new InvalidOperationException(
828
                    'Found non-balanced call to _pushSegment and popSegment'
829
                );
830
            }
831
        }
832
    }
833
834
    /**
835
     * Assert that the given condition is true.