QueryBuilderTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createQueryBuilder() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace Janisbiz\LightOrm\Tests\Unit\Dms\MySQL\QueryBuilder;
4
5
use Janisbiz\LightOrm\Dms\MySQL\QueryBuilder\QueryBuilder;
6
use Janisbiz\LightOrm\Entity\EntityInterface;
7
use Janisbiz\LightOrm\Repository\RepositoryInterface;
8
9
trait QueryBuilderTrait
10
{
11
    /**
12
     * @param RepositoryInterface $repository
13
     * @param EntityInterface|null $entity
14
     *
15
     * @return QueryBuilder
16
     */
17
    protected function createQueryBuilder(RepositoryInterface $repository, EntityInterface $entity = null)
18
    {
19
        $abstractRepositoryCreateClosureMethod = new \ReflectionMethod($repository, 'createRepositoryCallClosure');
20
        $abstractRepositoryCreateClosureMethod->setAccessible(true);
21
22
        return new QueryBuilder($abstractRepositoryCreateClosureMethod->invoke($repository), $entity);
23
    }
24
}
25