Code Duplication    Length = 19-19 lines in 2 locations

lib/private/SubAdmin.php 2 locations

@@ 113-131 (lines=19) @@
110
	 * @param IUser $user the SubAdmin
111
	 * @return IGroup[]
112
	 */
113
	public function getSubAdminsGroups(IUser $user) {
114
		$qb = $this->dbConn->getQueryBuilder();
115
116
		$result = $qb->select('gid')
117
			->from('group_admin')
118
			->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
119
			->execute();
120
121
		$groups = [];
122
		while($row = $result->fetch()) {
123
			$group = $this->groupManager->get($row['gid']);
124
			if(!is_null($group)) {
125
				$groups[] = $group;
126
			}
127
		}
128
		$result->closeCursor();
129
130
		return $groups;
131
	}
132
133
	/**
134
	 * get SubAdmins of a group
@@ 138-156 (lines=19) @@
135
	 * @param IGroup $group the group
136
	 * @return IUser[]
137
	 */
138
	public function getGroupsSubAdmins(IGroup $group) {
139
		$qb = $this->dbConn->getQueryBuilder();
140
141
		$result = $qb->select('uid')
142
			->from('group_admin')
143
			->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID())))
144
			->execute();
145
146
		$users = [];
147
		while($row = $result->fetch()) {
148
			$user = $this->userManager->get($row['uid']);
149
			if(!is_null($user)) {
150
				$users[] = $user;
151
			}
152
		}
153
		$result->closeCursor();
154
155
		return $users;
156
	}
157
158
	/**
159
	 * get all SubAdmins