Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4.25 |
Changes | 0 |
1 | <?php |
||
33 | 15 | private function appendRolesToContextGroups(?array $context): array |
|
34 | { |
||
35 | 15 | if ($this->getUser() === null) return $context; |
|
36 | |||
37 | 5 | if ($context === null) { |
|
38 | return [ |
||
39 | 'groups' => $this->getUser()->getRoles(), |
||
40 | ]; |
||
41 | } |
||
42 | |||
43 | 5 | if (isset($context['groups'])) { |
|
44 | 5 | $context['groups'] = array_merge($context['groups'], $this->getUser()->getRoles()); |
|
45 | } else { |
||
46 | $context['groups'] = $this->getUser()->getRoles(); |
||
47 | } |
||
48 | |||
49 | 5 | return $context; |
|
50 | } |
||
51 | } |