Code Duplication    Length = 19-19 lines in 2 locations

lib/private/SubAdmin.php 2 locations

@@ 114-132 (lines=19) @@
111
	 * @param IUser $user the SubAdmin
112
	 * @return IGroup[]
113
	 */
114
	public function getSubAdminsGroups(IUser $user) {
115
		$qb = $this->dbConn->getQueryBuilder();
116
117
		$result = $qb->select('gid')
118
			->from('group_admin')
119
			->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
120
			->execute();
121
122
		$groups = [];
123
		while($row = $result->fetch()) {
124
			$group = $this->groupManager->get($row['gid']);
125
			if(!is_null($group)) {
126
				$groups[$group->getGID()] = $group;
127
			}
128
		}
129
		$result->closeCursor();
130
131
		return $groups;
132
	}
133
134
	/**
135
	 * get an array of groupid and displayName for a user
@@ 150-168 (lines=19) @@
147
	 * @param IGroup $group the group
148
	 * @return IUser[]
149
	 */
150
	public function getGroupsSubAdmins(IGroup $group) {
151
		$qb = $this->dbConn->getQueryBuilder();
152
153
		$result = $qb->select('uid')
154
			->from('group_admin')
155
			->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID())))
156
			->execute();
157
158
		$users = [];
159
		while($row = $result->fetch()) {
160
			$user = $this->userManager->get($row['uid']);
161
			if(!is_null($user)) {
162
				$users[] = $user;
163
			}
164
		}
165
		$result->closeCursor();
166
167
		return $users;
168
	}
169
170
	/**
171
	 * get all SubAdmins