Code Duplication    Length = 13-18 lines in 5 locations

apps/workflowengine/lib/Manager.php 1 location

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

lib/private/Settings/Mapper.php 1 location

@@ 117-129 (lines=13) @@
114
	 * @param string $className
115
	 * @return bool
116
	 */
117
	public function has($table, $className) {
118
		$query = $this->dbc->getQueryBuilder();
119
		$query->select('class')
120
			->from($table)
121
			->where($query->expr()->eq('class', $query->createNamedParameter($className)))
122
			->setMaxResults(1);
123
124
		$result = $query->execute();
125
		$row = $result->fetch();
126
		$result->closeCursor();
127
128
		return (bool)$row;
129
	}
130
131
	/**
132
	 * deletes an settings or admin entry from the given table

apps/federatedfilesharing/lib/FederatedShareProvider.php 1 location

@@ 812-829 (lines=18) @@
809
	 * @return array
810
	 * @throws ShareNotFound
811
	 */
812
	private function getRawShare($id) {
813
814
		// Now fetch the inserted share and create a complete share object
815
		$qb = $this->dbConnection->getQueryBuilder();
816
		$qb->select('*')
817
			->from('share')
818
			->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
819
820
		$cursor = $qb->execute();
821
		$data = $cursor->fetch();
822
		$cursor->closeCursor();
823
824
		if ($data === false) {
825
			throw new ShareNotFound;
826
		}
827
828
		return $data;
829
	}
830
831
	/**
832
	 * Create a share object from an database row

apps/sharebymail/lib/ShareByMailProvider.php 1 location

@@ 797-814 (lines=18) @@
794
	 * @return array
795
	 * @throws ShareNotFound
796
	 */
797
	protected function getRawShare($id) {
798
799
		// Now fetch the inserted share and create a complete share object
800
		$qb = $this->dbConnection->getQueryBuilder();
801
		$qb->select('*')
802
			->from('share')
803
			->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
804
805
		$cursor = $qb->execute();
806
		$data = $cursor->fetch();
807
		$cursor->closeCursor();
808
809
		if ($data === false) {
810
			throw new ShareNotFound;
811
		}
812
813
		return $data;
814
	}
815
816
	public function getSharesInFolder($userId, Folder $node, $reshares) {
817
		$qb = $this->dbConnection->getQueryBuilder();

lib/private/BackgroundJob/JobList.php 1 location

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