Code Duplication    Length = 6-6 lines in 2 locations

src/PhpSpreadsheet/Calculation.php 2 locations

@@ 3140-3145 (lines=6) @@
3137
            } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) {    //    We have to explicitly deny a tilde or pipe, because they are legal
3138
                return $this->raiseFormulaError("Formula Error: Illegal character '~'"); //        on the stack but not in the input expression
3139
            } elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) {    //    Are we putting an operator on the stack?
3140
                while ($stack->count() > 0 &&
3141
                    ($o2 = $stack->last()) &&
3142
                    isset(self::$operators[$o2['value']]) &&
3143
                    @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) {
3144
                    $output[] = $stack->pop(); //    Swap operands and higher precedence operators from the stack to the output
3145
                }
3146
                $stack->push('Binary Operator', $opCharacter); //    Finally put our current operator onto the stack
3147
                ++$index;
3148
                $expectingOperator = false;
@@ 3378-3383 (lines=6) @@
3375
                //        Cell References) then we have an INTERSECTION operator
3376
                if (($expectingOperator) && (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '.*/Ui', substr($formula, $index), $match)) &&
3377
                    ($output[count($output) - 1]['type'] == 'Cell Reference')) {
3378
                    while ($stack->count() > 0 &&
3379
                        ($o2 = $stack->last()) &&
3380
                        isset(self::$operators[$o2['value']]) &&
3381
                        @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) {
3382
                        $output[] = $stack->pop(); //    Swap operands and higher precedence operators from the stack to the output
3383
                    }
3384
                    $stack->push('Binary Operator', '|'); //    Put an Intersect Operator on the stack
3385
                    $expectingOperator = false;
3386
                }