| Conditions | 4 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function getGroups($userId) |
||
| 34 | { |
||
| 35 | $memberOf = []; |
||
| 36 | |||
| 37 | $groupIdList = array_keys($this->config->toArray()); |
||
| 38 | foreach ($groupIdList as $groupId) { |
||
| 39 | $memberList = $this->config->getSection($groupId)->getSection('members')->toArray(); |
||
| 40 | if (!is_array($memberList) || !in_array($userId, $memberList)) { |
||
| 41 | continue; |
||
| 42 | } |
||
| 43 | |||
| 44 | $memberOf[] = [ |
||
| 45 | 'id' => $groupId, |
||
| 46 | 'displayName' => $this->config->getSection($groupId)->getItem('displayName'), |
||
| 47 | ]; |
||
| 48 | } |
||
| 49 | |||
| 50 | return $memberOf; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |