Code Duplication    Length = 15-18 lines in 3 locations

apps/federatedfilesharing/lib/FederatedShareProvider.php 1 location

@@ 752-769 (lines=18) @@
749
	 * @return array
750
	 * @throws ShareNotFound
751
	 */
752
	private function getRawShare($id) {
753
754
		// Now fetch the inserted share and create a complete share object
755
		$qb = $this->dbConnection->getQueryBuilder();
756
		$qb->select('*')
757
			->from('share')
758
			->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
759
760
		$cursor = $qb->execute();
761
		$data = $cursor->fetch();
762
		$cursor->closeCursor();
763
764
		if ($data === false) {
765
			throw new ShareNotFound;
766
		}
767
768
		return $data;
769
	}
770
771
	/**
772
	 * Create a share object from an database row

lib/private/BackgroundJob/JobList.php 1 location

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

apps/workflowengine/lib/Manager.php 1 location

@@ 154-168 (lines=15) @@
151
	 * @return array
152
	 * @throws \UnexpectedValueException
153
	 */
154
	protected function getOperation($id) {
155
		$query = $this->connection->getQueryBuilder();
156
		$query->select('*')
157
			->from('flow_operations')
158
			->where($query->expr()->eq('id', $query->createNamedParameter($id)));
159
		$result = $query->execute();
160
		$row = $result->fetch();
161
		$result->closeCursor();
162
163
		if ($row) {
164
			return $row;
165
		}
166
167
		throw new \UnexpectedValueException($this->l->t('Operation #%s does not exist', $id));
168
	}
169
170
	/**
171
	 * @param string $class