Code Duplication    Length = 17-19 lines in 3 locations

lib/Db/CirclesRequest.php 2 locations

@@ 180-198 (lines=19) @@
177
	 * @return FederatedLink
178
	 * @throws FederatedLinkDoesNotExistException
179
	 */
180
	public function getLinkFromToken($token, $uniqueId) {
181
		$qb = $this->getLinksSelectSql();
182
		$this->limitToUniqueId($qb, (string)$uniqueId);
183
		$this->limitToToken($qb, (string)$token);
184
185
		$cursor = $qb->execute();
186
		$data = $cursor->fetch();
187
188
		if ($data === false || $data === null) {
189
			throw new FederatedLinkDoesNotExistException(
190
				$this->l10n->t('Federated Link not found')
191
			);
192
		}
193
194
		$entry = $this->parseLinksSelectSql($data);
195
		$cursor->closeCursor();
196
197
		return $entry;
198
	}
199
200
201
	/**
@@ 209-226 (lines=18) @@
206
	 * @return FederatedLink
207
	 * @throws FederatedLinkDoesNotExistException
208
	 */
209
	public function getLinkFromId($linkId) {
210
		$qb = $this->getLinksSelectSql();
211
		$this->limitToId($qb, (string)$linkId);
212
213
		$cursor = $qb->execute();
214
		$data = $cursor->fetch();
215
		$cursor->closeCursor();
216
217
		if ($data === false || $data === null) {
218
			throw new FederatedLinkDoesNotExistException(
219
				$this->l10n->t('Federated Link not found')
220
			);
221
		}
222
223
		$entry = $this->parseLinksSelectSql($data);
224
225
		return $entry;
226
	}
227
228
229
	/**

lib/Db/MembersRequest.php 1 location

@@ 54-70 (lines=17) @@
51
	 * @return Member
52
	 * @throws MemberDoesNotExistException
53
	 */
54
	public function forceGetGroup($circleId, $groupId) {
55
		$qb = $this->getGroupsSelectSql();
56
57
		$this->limitToGroupId($qb, $groupId);
58
		$this->limitToCircleId($qb, $circleId);
59
60
		$cursor = $qb->execute();
61
		$data = $cursor->fetch();
62
		if ($data === false) {
63
			throw new MemberDoesNotExistException($this->l10n->t('This member does not exist'));
64
		}
65
66
		$group = Member::fromArray($this->l10n, $data);
67
		$cursor->closeCursor();
68
69
		return $group;
70
	}
71
72
73