Code Duplication    Length = 6-6 lines in 2 locations

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

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