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   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
eloc 20
dl 0
loc 48
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getSql() 0 3 1
A getResult() 0 3 1
A setRepo() 0 3 1
A __construct() 0 6 1
A buildForEntity() 0 17 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