Code Duplication    Length = 13-17 lines in 5 locations

lib/Db/AccountsRequest.php 1 location

@@ 66-78 (lines=13) @@
63
	/**
64
	 * @return array
65
	 */
66
	public function getAll(): array {
67
		$qb = $this->getAccountsSelectSql();
68
69
		$accounts = [];
70
		$cursor = $qb->execute();
71
		while ($data = $cursor->fetch()) {
72
			$account = $this->parseAccountsSelectSql($data);
73
			$accounts[$account['userId']] = $account;
74
		}
75
		$cursor->closeCursor();
76
77
		return $accounts;
78
	}
79
80
}
81

lib/ShareByCircleProvider.php 1 location

@@ 386-398 (lines=13) @@
383
	 *
384
	 * @return Share[]
385
	 */
386
	public function getSharesInFolder($userId, Folder $node, $reshares) {
387
		$qb = $this->getBaseSelectSql();
388
		$this->limitToShareOwner($qb, $userId, true);
389
		$cursor = $qb->execute();
390
391
		$shares = [];
392
		while ($data = $cursor->fetch()) {
393
			$shares[$data['file_source']][] = $this->createShareObject($data);
394
		}
395
		$cursor->closeCursor();
396
397
		return $shares;
398
	}
399
400
401
	/**

lib/Db/SharesRequest.php 1 location

@@ 82-96 (lines=15) @@
79
	 *
80
	 * @return array
81
	 */
82
	public function getSharesForCircle(string $circleId) {
83
		$qb = $this->getSharesSelectSql();
84
85
		$this->limitToShareWith($qb, $circleId);
86
		$this->limitToShareType($qb, self::SHARE_TYPE);
87
88
		$shares = [];
89
		$cursor = $qb->execute();
90
		while ($data = $cursor->fetch()) {
91
			$shares[] = $data;
92
		}
93
		$cursor->closeCursor();
94
95
		return $shares;
96
	}
97
98
99
	/**

lib/Db/DeprecatedCirclesRequest.php 2 locations

@@ 87-99 (lines=13) @@
84
	 *
85
	 * @return DeprecatedCircle[]
86
	 */
87
	public function forceGetCircles(string $ownerId = '') {
88
		$qb = $this->getCirclesSelectSql();
89
		$this->leftJoinOwner($qb, $ownerId);
90
91
		$circles = [];
92
		$cursor = $qb->execute();
93
		while ($data = $cursor->fetch()) {
94
			$circles[] = $this->parseCirclesSelectSql($data, true);
95
		}
96
		$cursor->closeCursor();
97
98
		return $circles;
99
	}
100
101
102
	/**
@@ 399-415 (lines=17) @@
396
	 *
397
	 * @return DeprecatedCircle[]
398
	 */
399
	public function getFromContactBook(int $addressBookId): array {
400
		$qb = $this->getCirclesSelectSql();
401
402
		if ($addressBookId > 0) {
403
			$this->limitToAddressBookId($qb, $addressBookId);
404
		}
405
406
407
		$circles = [];
408
		$cursor = $qb->execute();
409
		while ($data = $cursor->fetch()) {
410
			$circles[] = $this->parseCirclesSelectSql($data);
411
		}
412
		$cursor->closeCursor();
413
414
		return $circles;
415
	}
416
417
418
	/**