Code Duplication    Length = 7-7 lines in 2 locations

lib/Service/GroupFoldersService.php 1 location

@@ 285-291 (lines=7) @@
282
	 * @return string
283
	 */
284
	private function getRandomUserFromGroups(array $groups): string {
285
		foreach ($groups as $groupName) {
286
			$group = $this->groupManager->get($groupName);
287
			$users = $group->getUsers();
288
			if (sizeof($users) > 0) {
289
				return array_keys($users)[0];
290
			}
291
		}
292
293
		return '';
294
	}

lib/Service/ExternalFilesService.php 1 location

@@ 320-326 (lines=7) @@
317
			$groups = ['admin'];
318
		}
319
320
		foreach ($groups as $groupName) {
321
			$group = $this->groupManager->get($groupName);
322
			$users = $group->getUsers();
323
			if (sizeof($users) > 0) {
324
				return array_keys($users)[0];
325
			}
326
		}
327
328
		throw new ExternalMountWithNoViewerException(
329
			'cannot get a valid user for external mount'