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
Pull Request — master (#95)
by Ross
13:04 queued 10:08
created

ClassMetadataWithEntityFactories::setFactories()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\EntityManager\Mapping;
4
5
use Doctrine\ORM\Mapping\ClassMetadata;
6
use Doctrine\ORM\Mapping\NamingStrategy;
7
8
class ClassMetadataWithEntityFactories extends ClassMetadata
9
{
10
    /** @var EntityFactoryInterface[] */
11
    private $entityFactories;
12
    /** @var GenericFactoryInterface|null */
13
    private $genericFactory;
14
15
    public function __construct(
16
        $entityName,
17
        NamingStrategy $namingStrategy = null,
18
        array $entityFactories = [],
19
        GenericFactoryInterface $genericFactory = null
20
    ) {
21
        parent::__construct($entityName, $namingStrategy);
22
        $this->entityFactories = $entityFactories;
23
        $this->genericFactory  = $genericFactory;
24
    }
25
26
    public function newInstance()
27
    {
28
        if (isset($this->entityFactories[$this->name])) {
29
            return $this->entityFactories[$this->name]->getEntity();
30
        }
31
32
        if ($this->genericFactory !== null) {
33
            return $this->genericFactory->getEntity($this->name);
34
        }
35
36
        return parent::newInstance();
37
    }
38
39
    public function setFactories(array $entityFactories, GenericFactoryInterface $genericFactory = null)
40
    {
41
        $this->entityFactories = $entityFactories;
42
        $this->genericFactory  = $genericFactory;
43
    }
44
}
45