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
Push — feature/2.2/provide_field_usab... ( 03364e...b3bc72 )
by Simone
03:35
created

Sherlock::getRelations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Mado\QueryBundle\Component\Sherlock;
4
5
use Doctrine\ORM\EntityManagerInterface;
6
use Mado\QueryBundle\Dictionary;
7
use Mado\QueryBundle\Services\StringParser;
8
9
class Sherlock
10
{
11
    private $currentMetadata;
0 ignored issues
show
introduced by
The private property $currentMetadata is not used, and could be removed.
Loading history...
12
13 2
    public function __construct(
14
        EntityManagerInterface $manager
15
    ) {
16 2
        $this->metadata = CurrentMetaData::fromEntityManager($manager);
0 ignored issues
show
Bug Best Practice introduced by
The property metadata does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
17 2
    }
18
19 2
    public function getOpList($entityPath) : array
20
    {
21 2
        $opList = [];
22
23 2
        foreach ($this->metadata->justEntitiesMetadata() as $entityClass) {
24 2
            $fields = $this->metadata->extractFields($entityClass);
25
26 2
            $entity = StringParser::dotNotationFor($entityClass);
27 2
            $opList[$entity]['fields'] = $fields;
28
29 2
            if ($this->metadata->haveRelations()) {
30 2
                $relations = $this->metadata->getRelations();
31 2
                $opList[$entity]['relations'][] = $relations;
32
            }
33
        }
34
35 2
        return $opList[$entityPath];
36
    }
37
38 1
    public function getRelations($entityPath) : array
39
    {
40 1
        return current($this->getOpList($entityPath)['relations']);
41
    }
42
}
43