Code Duplication    Length = 17-18 lines in 2 locations

apps/federatedfilesharing/lib/federatedshareprovider.php 2 locations

@@ 249-266 (lines=18) @@
246
	 * @param IShare $parent
247
	 * @return IShare[]
248
	 */
249
	public function getChildren(IShare $parent) {
250
		$children = [];
251
252
		$qb = $this->dbConnection->getQueryBuilder();
253
		$qb->select('*')
254
			->from('share')
255
			->where($qb->expr()->eq('parent', $qb->createNamedParameter($parent->getId())))
256
			->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_REMOTE)))
257
			->orderBy('id');
258
259
		$cursor = $qb->execute();
260
		while($data = $cursor->fetch()) {
261
			$children[] = $this->createShare($data);
262
		}
263
		$cursor->closeCursor();
264
265
		return $children;
266
	}
267
268
	/**
269
	 * Delete a share
@@ 384-400 (lines=17) @@
381
	 * @param \OCP\Files\Node $path
382
	 * @return IShare[]
383
	 */
384
	public function getSharesByPath(Node $path) {
385
		$qb = $this->dbConnection->getQueryBuilder();
386
387
		$cursor = $qb->select('*')
388
			->from('share')
389
			->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($path->getId())))
390
			->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_REMOTE)))
391
			->execute();
392
393
		$shares = [];
394
		while($data = $cursor->fetch()) {
395
			$shares[] = $this->createShare($data);
396
		}
397
		$cursor->closeCursor();
398
399
		return $shares;
400
	}
401
402
	/**
403
	 * @inheritdoc