GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — 2.2 (#169)
by Simone
08:29 queued 05:42
created

HttpRepository::getSql()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 0
cts 2
cp 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Mado\QueryBundle\Repositories;
4
5
use Mado\QueryBundle\Repositories\BaseRepository;
6
use Doctrine\ORM\EntityManagerInterface;
7
use Symfony\Component\HttpFoundation\RequestStack;
8
9
class HttpRepository
10
{
11
    private $manager;
12
13
    private $stack;
14
15
    private $repo;
16
17
    public function __construct(
18
        EntityManagerInterface $manager,
19
        RequestStack $stack
20
    ) {
21
        $this->manager = $manager;
22
        $this->stack = $stack;
23
    }
24
25
    public function setRepo(BaseRepository $repo)
26
    {
27
        $this->repo = $repo;
28
    }
29
30
    public function buildForEntity(string $entityClassName)
31
    {
32
        if (!$this->repo) {
33
            $this->repo = new BaseRepository(
34
                $this->manager,
35
                $this->manager->getClassMetadata($entityClassName)
36
            );
37
        }
38
39
        $this->repo->setRequest($this->stack->getCurrentRequest());
40
41
        $this->query = $this->repo
0 ignored issues
show
Bug Best Practice introduced by
The property query does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
42
            ->getQueryBuilderFactory()
43
            ->filter()
44
            ->sort()
45
            ->getQueryBuilder()
46
            ->getQuery();
47
    }
48
49
    public function getSql()
50
    {
51
        return $this->query->getSql();
52
    }
53
54
    public function getResult()
55
    {
56
        return $this->query->getResult();
57
    }
58
}
59