Code Duplication    Length = 15-16 lines in 4 locations

lib/Db/FederatedLinksRequest.php 1 location

@@ 157-171 (lines=15) @@
154
	 * @return FederatedLink
155
	 * @throws FederatedLinkDoesNotExistException
156
	 */
157
	public function getLinkFromCircle($circleUniqueId, $linkUniqueId) {
158
		$qb = $this->getLinksSelectSql();
159
		$this->limitToCircleId($qb, $circleUniqueId);
160
		$this->limitToUniqueId($qb, $linkUniqueId);
161
162
		$cursor = $qb->execute();
163
		$data = $cursor->fetch();
164
		$cursor->closeCursor();
165
166
		if ($data === false) {
167
			throw new FederatedLinkDoesNotExistException($this->l10n->t('Federated link not found'));
168
		}
169
170
		return $this->parseLinksSelectSql($data);
171
	}
172
173
174
	/**

lib/Db/SharingFrameRequest.php 1 location

@@ 44-59 (lines=16) @@
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
		return $this->parseSharesSelectSql($data);
59
	}
60
61
62
	/**

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/DeprecatedCirclesRequest.php 1 location

@@ 425-439 (lines=15) @@
422
	 * @return DeprecatedCircle
423
	 * @throws CircleDoesNotExistException
424
	 */
425
	public function getFromContactGroup(int $addressBookId, string $group): DeprecatedCircle {
426
		$qb = $this->getCirclesSelectSql();
427
		$this->limitToAddressBookId($qb, $addressBookId);
428
		$this->limitToContactGroup($qb, $group);
429
430
		$cursor = $qb->execute();
431
		$data = $cursor->fetch();
432
		$cursor->closeCursor();
433
434
		if ($data === false) {
435
			throw new CircleDoesNotExistException($this->l10n->t('Circle not found'));
436
		}
437
438
		return $this->parseCirclesSelectSql($data);
439
	}
440
441
}
442