Code Duplication    Length = 15-19 lines in 4 locations

lib/Db/MembersRequest.php 2 locations

@@ 53-71 (lines=19) @@
50
	 * @return Member
51
	 * @throws MemberDoesNotExistException
52
	 */
53
	public function forceGetMember($circleUniqueId, $userId, $type) {
54
		$qb = $this->getMembersSelectSql();
55
56
		$this->limitToUserId($qb, $userId);
57
		$this->limitToUserType($qb, $type);
58
		$this->limitToCircleId($qb, $circleUniqueId);
59
60
		$cursor = $qb->execute();
61
		$data = $cursor->fetch();
62
		$cursor->closeCursor();
63
64
		if ($data === false) {
65
			throw new MemberDoesNotExistException($this->l10n->t('This member does not exist'));
66
		}
67
68
		$member = $this->parseMembersSelectSql($data);
69
70
		return $member;
71
	}
72
73
74
	/**
@@ 213-229 (lines=17) @@
210
	 * @return Member
211
	 * @throws MemberDoesNotExistException
212
	 */
213
	public function forceGetGroup($circleUniqueId, $groupId) {
214
		$qb = $this->getGroupsSelectSql();
215
216
		$this->limitToGroupId($qb, $groupId);
217
		$this->limitToCircleId($qb, $circleUniqueId);
218
219
		$cursor = $qb->execute();
220
		$data = $cursor->fetch();
221
		if ($data === false) {
222
			throw new MemberDoesNotExistException($this->l10n->t('This member does not exist'));
223
		}
224
225
		$group = $this->parseGroupsSelectSql($data);
226
		$cursor->closeCursor();
227
228
		return $group;
229
	}
230
231
232
	/**

lib/Db/SharingFrameRequest.php 1 location

@@ 44-61 (lines=18) @@
41
	 * @return SharingFrame
42
	 * @throws SharingFrameDoesNotExistException
43
	 */
44
	public function getSharingFrame($circleUniqueId, $frameUniqueId) {
45
		$qb = $this->getSharesSelectSql();
46
		$this->limitToUniqueId($qb, $frameUniqueId);
47
		$this->limitToCircleId($qb, $circleUniqueId);
48
		$this->leftJoinCircle($qb);
49
50
		$cursor = $qb->execute();
51
		$data = $cursor->fetch();
52
		$cursor->closeCursor();
53
54
		if ($data === false) {
55
			throw new SharingFrameDoesNotExistException($this->l10n->t('Sharing Frame does not exist'));
56
		}
57
58
		$entry = $this->parseSharesSelectSql($data);
59
60
		return $entry;
61
	}
62
63
64
	/**

lib/Db/TokensRequest.php 1 location

@@ 74-88 (lines=15) @@
71
	 * @return SharesToken
72
	 * @throws TokenDoesNotExistException
73
	 */
74
	public function getTokenFromMember(string $shareId, string $circleId, string $email) {
75
		$qb = $this->getTokensSelectSql();
76
		$this->limitToShareId($qb, $shareId);
77
		$this->limitToUserId($qb, $email);
78
		$this->limitToCircleId($qb, $circleId);
79
80
		$cursor = $qb->execute();
81
		$data = $cursor->fetch();
82
		$cursor->closeCursor();
83
		if ($data === false) {
84
			throw new TokenDoesNotExistException('Unknown share token');
85
		}
86
87
		return $this->parseTokensSelectSql($data);
88
	}
89
90
91
	/**