diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-07-08 16:56:07 +0200 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-08-06 12:13:26 +0200 |
commit | db16a32ac3bf851b0f16034c6fbf348f3bb30577 (patch) | |
tree | 38fc1612fbaf2e2ab3ce724ff3d92509b2684fac /core/Command/Group/ListCommand.php | |
parent | 7a7f259f3c3c3d9eb7e58d1e0f1ee93090582c80 (diff) | |
download | nextcloud-server-db16a32ac3bf851b0f16034c6fbf348f3bb30577.tar.gz nextcloud-server-db16a32ac3bf851b0f16034c6fbf348f3bb30577.zip |
feat(occ): Add support for iterable in Base and use in in group:list and user:list
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'core/Command/Group/ListCommand.php')
-rw-r--r-- | core/Command/Group/ListCommand.php | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/core/Command/Group/ListCommand.php b/core/Command/Group/ListCommand.php index bea6d08c76f..f4c531bbc89 100644 --- a/core/Command/Group/ListCommand.php +++ b/core/Command/Group/ListCommand.php @@ -68,25 +68,18 @@ class ListCommand extends Base { /** * @param IGroup[] $groups - * @return array */ - private function formatGroups(array $groups, bool $addInfo = false) { - $keys = array_map(function (IGroup $group) { - return $group->getGID(); - }, $groups); - - if ($addInfo) { - $values = array_map(function (IGroup $group) { - return [ + private function formatGroups(array $groups, bool $addInfo = false): \Generator { + foreach ($groups as $group) { + if ($addInfo) { + $value = [ 'backends' => $group->getBackendNames(), 'users' => $this->usersForGroup($group), ]; - }, $groups); - } else { - $values = array_map(function (IGroup $group) { - return $this->usersForGroup($group); - }, $groups); + } else { + $value = $this->usersForGroup($group); + } + yield $group->getGID() => $value; } - return array_combine($keys, $values); } } |