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.
Completed
Push — master ( c622f2...85cf53 )
by Anderson
02:20
created

ElasticRepositoryManager::getAnnotationReader()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace DoctrineElastic\Repository;
4
5
use Doctrine\Common\Annotations\AnnotationReader;
6
use Doctrine\ORM\Mapping\Entity;
7
use DoctrineElastic\ElasticEntityManager;
8
9
/**
10
 * @author Andsalves <[email protected]>
11
 */
12
class ElasticRepositoryManager {
13
14
    /** @var ElasticEntityRepository[] */
15
    protected $repositoryList;
16
17
    /** @var AnnotationReader */
18
    protected $annotationReader;
19
20
    public function getRepository(ElasticEntityManager $entityManager, $className) {
21
        $hashKey = md5($className) . spl_object_hash($entityManager);
22
23
        if (!isset($this->repositoryList[$hashKey])) {
24
            $repositoryClass = ElasticEntityRepository::class;
25
26
            /** @var Entity $entityAnnotation */
27
            $entityAnnotation = $this->getAnnotationReader()->getClassAnnotation(
28
                new \ReflectionClass($className), Entity::class
29
            );
30
            if (!is_null($entityAnnotation) && isset($entityAnnotation->repositoryClass)) {
31
                $repositoryClass = $entityAnnotation->repositoryClass;
32
            }
33
34
            $repository = new $repositoryClass($entityManager, $className);
35
            $this->repositoryList[$hashKey] = $repository;
36
        }
37
38
        return $this->repositoryList[$hashKey];
39
    }
40
41
    public function getAnnotationReader() {
42
        if (is_null($this->annotationReader)) {
43
            $this->annotationReader = new AnnotationReader();
44
        }
45
46
        return $this->annotationReader;
47
    }
48
}
49