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.
Test Failed
Push — master ( 63e980...f7805d )
by joseph
07:14
created

AbstractEntityRepositoryFactory::getRepository()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Repositories;
4
5
use Doctrine\ORM\EntityManagerInterface;
6
use Doctrine\ORM\EntityRepository;
7
8
abstract class AbstractEntityRepositoryFactory
9
{
10
    /**
11
     * @var EntityManagerInterface
12
     */
13
    protected $entityManager;
14
15
    /**
16
     * @var \ReflectionClass
17
     */
18
    protected $reflectionClass;
19
20
    /**
21
     * @var EntityRepository
22
     */
23
    protected $entityRepository;
24
25
    /**
26
     * @var string
27
     */
28
    protected $repositoryFactoryFqn;
29
30
    /**
31
     * AbstractEntityRepositoryFactory constructor.
32
     * @param EntityManagerInterface $entityManager
33
     * @throws \ReflectionException
34
     */
35
    public function __construct(EntityManagerInterface $entityManager)
36
    {
37
        $this->entityManager        = $entityManager;
38
        $this->reflectionClass      = new \ReflectionClass($this);
39
        $this->repositoryFactoryFqn = $this->reflectionClass->getName();
40
    }
41
42
    public function getRepository()
43
    {
44
        if (null === $this->entityRepository) {
45
            $entityFqn     = $this->getEntityFqn();
46
            $repositoryFqn = $this->getRepositoryFqn();
47
            $metaData      = $this->entityManager->getClassMetadata($entityFqn);
48
49
            $this->entityRepository = new $repositoryFqn($this->entityManager, $metaData);
50
        }
51
52
        return $this->entityRepository;
53
    }
54
55
    protected function getEntityFqn()
56
    {
57
        return '\\'.\str_replace(
58
            ['Entity\\Repositories', 'RepositoryFactory'],
59
            ['Entities', ''],
60
            $this->repositoryFactoryFqn
61
        );
62
    }
63
64
    protected function getRepositoryFqn()
65
    {
66
        return '\\'.\str_replace(
67
            'Factory',
68
            '',
69
            $this->repositoryFactoryFqn
70
        );
71
    }
72
}
73