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
	/**
@@ 344-359 (lines=16) @@
341
	 * @return Circle
342
	 * @throws CircleDoesNotExistException
343
	 */
344
	public function getCircleFromUniqueId($uniqueId) {
345
		$qb = $this->getCirclesSelectSql();
346
		$this->limitToUniqueId($qb, (string)$uniqueId);
347
348
		$cursor = $qb->execute();
349
		$data = $cursor->fetch();
350
		$cursor->closeCursor();
351
352
		if ($data === false) {
353
			throw new CircleDoesNotExistException($this->l10n->t('Circle not found'));
354
		}
355
356
		$entry = $this->parseCirclesSelectSql($data);
357
358
		return $entry;
359
	}
360
361
362
	/**

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