Code Duplication    Length = 12-13 lines in 2 locations

src/POData/ObjectModel/ObjectModelSerializerBase.php 1 location

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

src/POData/UriProcessor/UriProcessor.php 1 location

@@ 794-806 (lines=13) @@
791
     * @throws InvalidOperationException If found un-balanced call
792
     *                                   with _pushSegment
793
     */
794
    private function _popSegment($needPop)
795
    {
796
        if ($needPop) {
797
            if (!empty($this->_segmentNames)) {
798
                array_pop($this->_segmentNames);
799
                array_pop($this->_segmentResourceSetWrappers);
800
            } else {
801
                throw new InvalidOperationException(
802
                    'Found non-balanced call to _pushSegment and popSegment'
803
                );
804
            }
805
        }
806
    }
807
808
    /**
809
     * Assert that the given condition is true.