Completed
Push — master ( 0b486e...c4293f )
by Derek Stephen
07:32 queued 06:29
created

UserPackage::getEntityPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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