Passed
Push — master ( ec308f...430c19 )
by Julito
08:35 queued 11s
created

getOrCreateQueryBuilder()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chamilo\CoreBundle\Traits\Repository;
6
7
/* For licensing terms, see /license.txt */
8
9
use Doctrine\ORM\QueryBuilder;
10
11
trait RepositoryQueryBuilderTrait
12
{
13
    abstract public function createQueryBuilder($alias, $indexBy = null);
14
15
    protected function getOrCreateQueryBuilder(QueryBuilder $qb = null, string $alias = 'resource'): QueryBuilder
16
    {
17
        return $qb ?: $this->createQueryBuilder($alias);
18
    }
19
}