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

RepositoryQueryBuilderTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 7
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getOrCreateQueryBuilder() 0 3 2
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
}