UserPackage   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 0 Features 0
Metric Value
eloc 12
c 6
b 0
f 0
dl 0
loc 36
ccs 14
cts 14
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addToContainer() 0 11 2
A getEntityPath() 0 3 1
A registerConsoleCommands() 0 6 1
1
<?php
2
3
namespace Del;
4
5
use Barnacle\EntityRegistrationInterface;
6
use Barnacle\RegistrationInterface;
7
use Bone\Console\CommandRegistrationInterface;
8
use Del\Console\UserCommand;
9
use Del\Person\PersonPackage;
10
use Del\Person\Service\PersonService;
11
use Del\Service\UserService;
12
use Barnacle\Container;
13
use Doctrine\ORM\EntityManager;
14
15
class UserPackage implements RegistrationInterface, EntityRegistrationInterface, CommandRegistrationInterface
16
{
17
    /**
18
     * @param Container $c
19
     */
20 3
    public function addToContainer(Container $c): void
21
    {
22 3
        if (!$c->has(PersonService::class)) {
23 1
            $personPackage = new PersonPackage();
24 1
            $personPackage->addToContainer($c);
25
        }
26
27 3
        $entityManager = $c->get(EntityManager::class);
28 3
        $personService = $c->get(PersonService::class);
29 3
        $userService = new UserService($entityManager, $personService);
30 3
        $c[UserService::class] = $userService;
31
    }
32
33
    /**
34
     * @return string
35
     */
36 1
    public function getEntityPath(): string
37
    {
38 1
        return 'vendor/delboy1978uk/user/src/Entity';
39
    }
40
41
    /**
42
     * @param Container $container
43
     * @return array
44
     */
45 1
    public function registerConsoleCommands(Container $container): array
46
    {
47 1
        $userService = $container->get(UserService::class);
48 1
        $userCommand = new UserCommand($userService);
49
50 1
        return [$userCommand];
51
    }
52
}
53