Code Duplication    Length = 6-6 lines in 2 locations

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

@@ 232-237 (lines=6) @@
229
230
					$results[] = array_reduce($users, function(array $carry, IUser $user) use ($restrictGroups) {
231
						// is sharing restricted to groups only?
232
						if ($restrictGroups !== false) {
233
							$userGroups = $this->groupManager->getUserGroupIds($user);
234
							if (count(array_intersect($userGroups, $restrictGroups)) === 0) {
235
								return $carry;
236
							}
237
						}
238
239
						$carry[] = $this->principalPrefix . '/' . $user->getUID();
240
						return $carry;
@@ 317-322 (lines=6) @@
314
				}
315
				$user = $users[0];
316
317
				if ($restrictGroups !== false) {
318
					$userGroups = $this->groupManager->getUserGroupIds($user);
319
					if (count(array_intersect($userGroups, $restrictGroups)) === 0) {
320
						return null;
321
					}
322
				}
323
324
				return $this->principalPrefix . '/' . $user->getUID();
325
			}