Completed
Push — master ( 622106...eab52f )
by Derek Stephen
02:07
created

User   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 68.42%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 0
cbo 3
dl 0
loc 41
ccs 13
cts 19
cp 0.6842
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A addToContainer() 0 5 1
A addUserRepository() 0 10 1
A addUserService() 0 7 1
A getEntityPath() 0 4 1
A hasEntityPath() 0 4 1
1
<?php
2
3
namespace Del\Config\Container;
4
5
use Del\Common\Container\RegistrationInterface;
6
use Del\Repository\User as UserRepository;
7
use Del\Service\User as UserService;
8
use Doctrine\ORM\EntityManager;
9
use Pimple\Container;
10
11
class User implements RegistrationInterface
12
{
13
    /**
14
     * @param Container $c
15
     */
16 1
    public function addToContainer(Container $c)
17
    {
18 1
        $this->addUserRepository($c);
19 1
        $this->addUserService($c);
20 1
    }
21
22 1
    private function addUserRepository(Container $c)
23
    {
24
        $c['repository.user'] = $c->factory(function ($c) {
25
            /** @var EntityManager $em */
26 1
            $em = $c['doctrine.entity_manager'];
27
            /** @var UserRepository $repo */
28 1
            $repo = $em->getRepository('Del\Entity\User');
29 1
            return $repo;
30 1
        });
31 1
    }
32
33
    private function addUserService(Container $c)
34
    {
35 1
        $c['service.user'] = $c->factory(function ($c) {
36
            $svc = new UserService($c['doctrine.entity_manager'], $c['service.person']);
37
            return $svc;
38 1
        });
39 1
    }
40
41
    public function getEntityPath()
42
    {
43
        return 'vendor/delboy1978uk/user/src/Entity';
44
    }
45
46
    public function hasEntityPath()
47
    {
48
        return true;
49
    }
50
51
}