Code Duplication    Length = 7-7 lines in 2 locations

lib/Service/ExternalFilesService.php 1 location

@@ 337-343 (lines=7) @@
334
			$groups = ['admin'];
335
		}
336
337
		foreach ($groups as $groupName) {
338
			$group = $this->groupManager->get($groupName);
339
			$users = $group->getUsers();
340
			if (sizeof($users) > 0) {
341
				return array_keys($users)[0];
342
			}
343
		}
344
345
		throw new ExternalMountWithNoViewerException(
346
			'cannot get a valid user for external mount'

lib/Service/GroupFoldersService.php 1 location

@@ 272-278 (lines=7) @@
269
	 * @return string
270
	 */
271
	private function getRandomUserFromGroups($groups) {
272
		foreach ($groups as $groupName) {
273
			$group = $this->groupManager->get($groupName);
274
			$users = $group->getUsers();
275
			if (sizeof($users) > 0) {
276
				return array_keys($users)[0];
277
			}
278
		}
279
280
		return '';
281
	}