Code Duplication    Length = 19-19 lines in 2 locations

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

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