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 (#156)
by Simone
06:47 queued 04:03
created

Sherlock   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 27
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getOpList() 0 17 3
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 1
    public function __construct(
14
        EntityManagerInterface $manager
15
    ) {
16 1
        $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 1
    }
18
19 1
    public function getOpList($entityPath) : array
20
    {
21 1
        $opList = [];
22
23 1
        foreach ($this->metadata->justEntitiesMetadata() as $entityClass) {
24 1
            $fields = $this->metadata->extractFields($entityClass);
25
26 1
            $entity = StringParser::dotNotationFor($entityClass);
27 1
            $opList[$entity]['fields'] = $fields;
28
29 1
            if ($this->metadata->haveRelations()) {
30 1
                $targetEntity = $this->metadata->getCurrentTargetEntity();
31 1
                $opList[$entity]['relations'] = [StringParser::dotNotationFor($targetEntity)];
32
            }
33
        }
34
35 1
        return $opList[$entityPath];
36
    }
37
}
38