Completed
Push — master ( bbd5c2...15f243 )
by Derek Stephen
01:52
created

UserPackage::addToContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1.1715

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 4
cts 9
cp 0.4444
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1.1715
1
<?php
2
3
namespace Del;
4
5
use Del\Common\Container\RegistrationInterface;
6
use Del\Person\PersonPackage;
7
use Del\Person\Service\PersonService;
8
use Del\Service\UserService;
9
use Barnacle\Container;
10
use Doctrine\ORM\EntityManager;
11
12
class UserPackage implements RegistrationInterface
13
{
14
    /**
15
     * @param Container $c
16
     */
17 26
    public function addToContainer(Container $c): void
18
    {
19
        $personPackage = new PersonPackage();
20
        $personPackage->addToContainer($c);
21
22
        $function = function (Container $c) {
23 26
            $entityManager = $c->get(EntityManager::class);
24 26
            $personService = $c->get(PersonService::class);
25
26 26
            return new UserService($entityManager, $personService);
27
        };
28
29
        $c[UserService::class] = $c->factory($function);
30
    }
31
32
    public function getEntityPath(): string
33
    {
34
        return 'vendor/delboy1978uk/user/src/Entity';
35
    }
36
37
    public function hasEntityPath(): bool
38
    {
39
        return true;
40
    }
41
}
42