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
	/**
@@ 174-190 (lines=17) @@
171
	 * @return Member
172
	 * @throws MemberDoesNotExistException
173
	 */
174
	public function forceGetGroup($circleUniqueId, $groupId) {
175
		$qb = $this->getGroupsSelectSql();
176
177
		$this->limitToGroupId($qb, $groupId);
178
		$this->limitToCircleId($qb, $circleUniqueId);
179
180
		$cursor = $qb->execute();
181
		$data = $cursor->fetch();
182
		if ($data === false) {
183
			throw new MemberDoesNotExistException($this->l10n->t('This member does not exist'));
184
		}
185
186
		$group = $this->parseGroupsSelectSql($data);
187
		$cursor->closeCursor();
188
189
		return $group;
190
	}
191
192
193
	/**

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

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