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

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

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

apps/sharebymail/lib/ShareByMailProvider.php 1 location

@@ 777-794 (lines=18) @@
774
	 * @return array
775
	 * @throws ShareNotFound
776
	 */
777
	protected function getRawShare($id) {
778
779
		// Now fetch the inserted share and create a complete share object
780
		$qb = $this->dbConnection->getQueryBuilder();
781
		$qb->select('*')
782
			->from('share')
783
			->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
784
785
		$cursor = $qb->execute();
786
		$data = $cursor->fetch();
787
		$cursor->closeCursor();
788
789
		if ($data === false) {
790
			throw new ShareNotFound;
791
		}
792
793
		return $data;
794
	}
795
796
	public function getSharesInFolder($userId, Folder $node, $reshares) {
797
		$qb = $this->dbConnection->getQueryBuilder();