RemoveGroupFromRoleCommandHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
eloc 9
c 1
b 1
f 0
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 1
A __construct() 0 4 1
1
<?php
2
3
namespace ProyectoTAU\TAU\Module\Administration\Role\Application\removeGroupFromRole;
4
5
use ProyectoTAU\TAU\Module\Administration\Group\Domain\GroupRepository;
6
use ProyectoTAU\TAU\Module\Administration\Role\Domain\RoleRepository;
7
8
final class RemoveGroupFromRoleCommandHandler
9
{
10
    private $groupRepository;
11
    private $roleRepository;
12
13 3
    public function __construct(GroupRepository $group, RoleRepository $role)
14
    {
15 3
        $this->groupRepository = $group;
16 3
        $this->roleRepository = $role;
17 3
    }
18
19 3
    public function handle(RemoveGroupFromRoleCommand $command)
20
    {
21 3
        $group = $this->groupRepository->read($command->groupId);
22 3
        $role = $this->roleRepository->read($command->roleId);
23
24 3
        $this->roleRepository->removeGroupFromRole($group, $role); //TODO: remove must use id only, do not read
25
26 3
        $role->removeGroup($group);
27 3
    }
28
}
29