Code Duplication    Length = 19-19 lines in 2 locations

lib/Doctrine/ORM/Query/Parser.php 2 locations

@@ 2382-2400 (lines=19) @@
2379
     *
2380
     * @return \Doctrine\ORM\Query\AST\ConditionalExpression
2381
     */
2382
    public function ConditionalExpression()
2383
    {
2384
        $conditionalTerms = [];
2385
        $conditionalTerms[] = $this->ConditionalTerm();
2386
2387
        while ($this->lexer->isNextToken(Lexer::T_OR)) {
2388
            $this->match(Lexer::T_OR);
2389
2390
            $conditionalTerms[] = $this->ConditionalTerm();
2391
        }
2392
2393
        // Phase 1 AST optimization: Prevent AST\ConditionalExpression
2394
        // if only one AST\ConditionalTerm is defined
2395
        if (count($conditionalTerms) == 1) {
2396
            return $conditionalTerms[0];
2397
        }
2398
2399
        return new AST\ConditionalExpression($conditionalTerms);
2400
    }
2401
2402
    /**
2403
     * ConditionalTerm ::= ConditionalFactor {"AND" ConditionalFactor}*
@@ 2407-2425 (lines=19) @@
2404
     *
2405
     * @return \Doctrine\ORM\Query\AST\ConditionalTerm
2406
     */
2407
    public function ConditionalTerm()
2408
    {
2409
        $conditionalFactors = [];
2410
        $conditionalFactors[] = $this->ConditionalFactor();
2411
2412
        while ($this->lexer->isNextToken(Lexer::T_AND)) {
2413
            $this->match(Lexer::T_AND);
2414
2415
            $conditionalFactors[] = $this->ConditionalFactor();
2416
        }
2417
2418
        // Phase 1 AST optimization: Prevent AST\ConditionalTerm
2419
        // if only one AST\ConditionalFactor is defined
2420
        if (count($conditionalFactors) == 1) {
2421
            return $conditionalFactors[0];
2422
        }
2423
2424
        return new AST\ConditionalTerm($conditionalFactors);
2425
    }
2426
2427
    /**
2428
     * ConditionalFactor ::= ["NOT"] ConditionalPrimary