Code Duplication    Length = 13-18 lines in 4 locations

lib/Db/CirclesRequest.php 2 locations

@@ 111-128 (lines=18) @@
108
	 * @return null|Circle
109
	 * @throws CircleDoesNotExistException
110
	 */
111
	public function forceGetCircleByName($name) {
112
113
		$qb = $this->getCirclesSelectSql();
114
115
		$this->limitToName($qb, $name);
116
117
		$cursor = $qb->execute();
118
		$data = $cursor->fetch();
119
		$cursor->closeCursor();
120
121
		if ($data === false) {
122
			throw new CircleDoesNotExistException($this->l10n->t('Circle not found'));
123
		}
124
125
		$entry = $this->parseCirclesSelectSql($data);
126
127
		return $entry;
128
	}
129
130
131
	/**
@@ 342-357 (lines=16) @@
339
	 * @return Circle
340
	 * @throws CircleDoesNotExistException
341
	 */
342
	public function getCircleFromUniqueId($uniqueId) {
343
		$qb = $this->getCirclesSelectSql();
344
		$this->limitToUniqueId($qb, (string)$uniqueId);
345
346
		$cursor = $qb->execute();
347
		$data = $cursor->fetch();
348
		$cursor->closeCursor();
349
350
		if ($data === false) {
351
			throw new CircleDoesNotExistException($this->l10n->t('Circle not found'));
352
		}
353
354
		$entry = $this->parseCirclesSelectSql($data);
355
356
		return $entry;
357
	}
358
359
360
}

lib/Db/TokensRequest.php 1 location

@@ 51-63 (lines=13) @@
48
	 * @return SharesToken
49
	 * @throws TokenDoesNotExistException
50
	 */
51
	public function getByToken(string $token) {
52
		$qb = $this->getTokensSelectSql();
53
		$this->limitToToken($qb, $token);
54
55
		$cursor = $qb->execute();
56
		$data = $cursor->fetch();
57
		$cursor->closeCursor();
58
		if ($data === false) {
59
			throw new TokenDoesNotExistException('Unknown share token');
60
		}
61
62
		return $this->parseTokensSelectSql($data);
63
	}
64
65
66
	/**

lib/ShareByCircleProvider.php 1 location

@@ 434-448 (lines=15) @@
431
	 * @return Share
432
	 * @throws ShareNotFound
433
	 */
434
	public function getShareById($shareId, $recipientId = null) {
435
		$qb = $this->getBaseSelectSql();
436
437
		$this->limitToShare($qb, $shareId);
438
439
		$cursor = $qb->execute();
440
		$data = $cursor->fetch();
441
		$cursor->closeCursor();
442
443
		if ($data === false) {
444
			throw new ShareNotFound();
445
		}
446
447
		return $this->createShareObject($data);
448
	}
449
450
451
	/**