Completed
Push — master ( e7d3f8...bbd5c2 )
by Derek Stephen
01:35
created

UserPackage::addToContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 10
cp 0
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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
    public function addToContainer(Container $c): void
18
    {
19
        $personPackage = new PersonPackage();
20
        $personPackage->addToContainer($c);
21
22
        $function = function (Container $c) {
23
            $entityManager = $c->get(EntityManager::class);
24
            $personService = $c->get(PersonService::class);
25
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