Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
34 | 3 | public function removeRole(array $currentRoles, RoleInterface $deleteRole): array |
|
35 | { |
||
36 | 3 | if ($deleteRole->getId() === null) { |
|
37 | 1 | throw new RoleIsNotSavedException; |
|
38 | } |
||
39 | |||
40 | 2 | $currentRoles = array_values(array_filter( |
|
41 | 2 | $currentRoles, |
|
42 | static function ($currentRole) use ($deleteRole) { |
||
43 | 2 | return $currentRole !== $deleteRole; |
|
44 | 2 | } |
|
45 | )); |
||
46 | |||
47 | 2 | return $currentRoles; |
|
48 | } |
||
49 | |||
61 |