Code Duplication    Length = 15-19 lines in 4 locations

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
	/**

lib/Db/MembersRequest.php 2 locations

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