Completed
Push — master ( d9248b...9015f5 )
by Derek Stephen
01:57
created

ExpensesPackage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 41.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 36
ccs 5
cts 12
cp 0.4167
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addToContainer() 0 13 1
A getEntityPath() 0 4 1
A hasEntityPath() 0 4 1
1
<?php
2
3
namespace Del\Expenses;
4
5
use Del\Common\Container\RegistrationInterface;
6
use Del\Expenses\Service\ExpensesService;
7
use Pimple\Container;
8
9
class ExpensesPackage implements RegistrationInterface
10
{
11
    /**
12
     * @param Container $c
13
     */
14
    public function addToContainer(Container $c)
15
    {
16 6
        $function = function($c){
17
            /** @var \Doctrine\ORM\EntityManager $em */
18 6
            $em = $c['doctrine.entity_manager'];
19
            /** @var \Del\Expenses\Repository\EntryRepository $repository */
20 6
            $repository = $em->getRepository('Del\Expenses\Entity\Entry');
21 6
            $svc = new ExpensesService($repository);
22 6
            return $svc;
23
        };
24
25
        $c['service.expenses'] = $c->factory($function);
26
    }
27
28
    /**
29
     * @return string
30
     */
31
    public function getEntityPath()
32
    {
33
        return 'vendor/delboy1978uk/expenses/src/Entity';
34
    }
35
36
    /**
37
     * @return bool
38
     */
39
    public function hasEntityPath()
40
    {
41
        return true;
42
    }
43
44
}