| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 2 | protected function getUserGroupChoices(): array |
|
| 34 | { |
||
| 35 | // Initialize output |
||
| 36 | 2 | $choices = []; |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Lambda function to iterate all user groups and to create necessary |
||
| 40 | * choices array. |
||
| 41 | */ |
||
| 42 | 2 | $iterator = static function (UserGroup $userGroup) use (&$choices): void { |
|
| 43 | 2 | $name = $userGroup->getName() . ' [' . $userGroup->getRole()->getId() . ']'; |
|
| 44 | |||
| 45 | 2 | $choices[$name] = $userGroup->getId(); |
|
| 46 | 2 | }; |
|
| 47 | |||
| 48 | 2 | array_map($iterator, $this->userGroupResource->find()); |
|
| 49 | |||
| 50 | 2 | return $choices; |
|
| 51 | } |
||
| 53 |