Code Duplication    Length = 15-18 lines in 2 locations

lib/private/backgroundjob/joblist.php 1 location

@@ 216-230 (lines=15) @@
213
	 * @param int $id
214
	 * @return IJob|null
215
	 */
216
	public function getById($id) {
217
		$query = $this->connection->getQueryBuilder();
218
		$query->select('*')
219
			->from('jobs')
220
			->where($query->expr()->eq('id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT)));
221
		$result = $query->execute();
222
		$row = $result->fetch();
223
		$result->closeCursor();
224
225
		if ($row) {
226
			return $this->buildJob($row);
227
		} else {
228
			return null;
229
		}
230
	}
231
232
	/**
233
	 * get the job object from a row in the db

apps/federatedfilesharing/lib/federatedshareprovider.php 1 location

@@ 480-497 (lines=18) @@
477
	 * @return array
478
	 * @throws ShareNotFound
479
	 */
480
	private function getRawShare($id) {
481
482
		// Now fetch the inserted share and create a complete share object
483
		$qb = $this->dbConnection->getQueryBuilder();
484
		$qb->select('*')
485
			->from('share')
486
			->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
487
488
		$cursor = $qb->execute();
489
		$data = $cursor->fetch();
490
		$cursor->closeCursor();
491
492
		if ($data === false) {
493
			throw new ShareNotFound;
494
		}
495
496
		return $data;
497
	}
498
499
	/**
500
	 * Create a share object from an database row