Code Duplication    Length = 6-6 lines in 2 locations

apps/dav/lib/Connector/Sabre/Principal.php 2 locations

@@ 241-246 (lines=6) @@
238
239
					$results[] = array_reduce($users, function(array $carry, IUser $user) use ($restrictGroups) {
240
						// is sharing restricted to groups only?
241
						if ($restrictGroups !== false) {
242
							$userGroups = $this->groupManager->getUserGroupIds($user);
243
							if (count(array_intersect($userGroups, $restrictGroups)) === 0) {
244
								return $carry;
245
							}
246
						}
247
248
						$carry[] = $this->principalPrefix . '/' . $user->getUID();
249
						return $carry;
@@ 327-332 (lines=6) @@
324
				}
325
				$user = $users[0];
326
327
				if ($restrictGroups !== false) {
328
					$userGroups = $this->groupManager->getUserGroupIds($user);
329
					if (count(array_intersect($userGroups, $restrictGroups)) === 0) {
330
						return null;
331
					}
332
				}
333
334
				return $this->principalPrefix . '/' . $user->getUID();
335
			}