Code Duplication    Length = 18-18 lines in 2 locations

lib/Doctrine/ORM/QueryBuilder.php 2 locations

@@ 445-462 (lines=18) @@
442
     *
443
     * @return array
444
     */
445
    public function getRootAliases()
446
    {
447
        $aliases = [];
448
449
        foreach ($this->_dqlParts['from'] as &$fromClause) {
450
            if (is_string($fromClause)) {
451
                $spacePos = strrpos($fromClause, ' ');
452
                $from     = substr($fromClause, 0, $spacePos);
453
                $alias    = substr($fromClause, $spacePos + 1);
454
455
                $fromClause = new Query\Expr\From($from, $alias);
456
            }
457
458
            $aliases[] = $fromClause->getAlias();
459
        }
460
461
        return $aliases;
462
    }
463
464
    /**
465
     * Gets all the aliases that have been used in the query.
@@ 497-514 (lines=18) @@
494
     *
495
     * @return array
496
     */
497
    public function getRootEntities()
498
    {
499
        $entities = [];
500
501
        foreach ($this->_dqlParts['from'] as &$fromClause) {
502
            if (is_string($fromClause)) {
503
                $spacePos = strrpos($fromClause, ' ');
504
                $from     = substr($fromClause, 0, $spacePos);
505
                $alias    = substr($fromClause, $spacePos + 1);
506
507
                $fromClause = new Query\Expr\From($from, $alias);
508
            }
509
510
            $entities[] = $fromClause->getFrom();
511
        }
512
513
        return $entities;
514
    }
515
516
    /**
517
     * Sets a query parameter for the query being constructed.