Passed
Pull Request — master (#8)
by Derek Stephen
10:36
created

PersonPackage::getEntityPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Del\Person;
6
7
use Barnacle\Container;
8
use Barnacle\EntityRegistrationInterface;
9
use Barnacle\RegistrationInterface;
10
use Del\Person\Service\PersonService;
11
use Doctrine\ORM\EntityManager;
12
13
class PersonPackage implements RegistrationInterface, EntityRegistrationInterface
14
{
15
    public function addToContainer(Container $c): void
16 5
    {
17
        $function = function(Container $c) {
18 5
            $entityManager = $c->get(EntityManager::class);
19 5
20
            return new PersonService($entityManager);
21 5
        };
22
23
        $c[PersonService::class] = $c->factory($function);
24 5
    }
25 5
26
    public function getEntityPath(): string
27
    {
28
        return 'vendor/delboy1978uk/person/src/Entity';
29
    }
30
}
31