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

UserPackage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 36.36%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 28
ccs 4
cts 11
cp 0.3636
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getEntityPath() 0 4 1
A addToContainer() 0 14 1
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