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

ExpensesPackage::hasEntityPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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
eloc 2
nc 1
nop 0
crap 2
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
}