Code Duplication    Length = 9-12 lines in 10 locations

lib/Controller/LocalController.php 10 locations

@@ 159-168 (lines=10) @@
156
	 * @return DataResponse
157
	 * @throws OCSException
158
	 */
159
	public function destroy(string $circleId): DataResponse {
160
		try {
161
			$this->setCurrentFederatedUser();
162
			$circle = $this->circleService->destroy($circleId);
163
164
			return new DataResponse($this->serializeArray($circle));
165
		} catch (Exception $e) {
166
			throw new OcsException($e->getMessage(), $e->getCode());
167
		}
168
	}
169
170
171
	/**
@@ 179-187 (lines=9) @@
176
	 * @return DataResponse
177
	 * @throws OCSException
178
	 */
179
	public function search(string $term): DataResponse {
180
		try {
181
			$this->setCurrentFederatedUser();
182
183
			return new DataResponse($this->serializeArray($this->searchService->search($term)));
184
		} catch (Exception $e) {
185
			throw new OcsException($e->getMessage(), $e->getCode());
186
		}
187
	}
188
189
190
	/**
@@ 198-206 (lines=9) @@
195
	 * @return DataResponse
196
	 * @throws OCSException
197
	 */
198
	public function circleDetails(string $circleId): DataResponse {
199
		try {
200
			$this->setCurrentFederatedUser();
201
202
			return new DataResponse($this->serialize($this->circleService->getCircle($circleId)));
203
		} catch (Exception $e) {
204
			throw new OcsException($e->getMessage(), $e->getCode());
205
		}
206
	}
207
208
209
	/**
@@ 283-292 (lines=10) @@
280
	 * @return DataResponse
281
	 * @throws OCSException
282
	 */
283
	public function circleJoin(string $circleId): DataResponse {
284
		try {
285
			$this->setCurrentFederatedUser();
286
			$result = $this->circleService->circleJoin($circleId);
287
288
			return new DataResponse($this->serializeArray($result));
289
		} catch (Exception $e) {
290
			throw new OCSException($e->getMessage(), $e->getCode());
291
		}
292
	}
293
294
295
	/**
@@ 303-312 (lines=10) @@
300
	 * @return DataResponse
301
	 * @throws OCSException
302
	 */
303
	public function circleLeave(string $circleId): DataResponse {
304
		try {
305
			$this->setCurrentFederatedUser();
306
			$result = $this->circleService->circleLeave($circleId);
307
308
			return new DataResponse($this->serializeArray($result));
309
		} catch (Exception $e) {
310
			throw new OCSException($e->getMessage(), $e->getCode());
311
		}
312
	}
313
314
315
	/**
@@ 379-390 (lines=12) @@
376
	 * @return DataResponse
377
	 * @throws OCSException
378
	 */
379
	public function memberRemove(string $circleId, string $memberId): DataResponse {
380
		try {
381
			$this->setCurrentFederatedUser();
382
			$this->memberService->getMemberById($memberId, $circleId);
383
384
			$result = $this->memberService->removeMember($memberId);
385
386
			return new DataResponse($this->serializeArray($result));
387
		} catch (Exception $e) {
388
			throw new OCSException($e->getMessage(), $e->getCode());
389
		}
390
	}
391
392
393
	/**
@@ 418-426 (lines=9) @@
415
	 * @return DataResponse
416
	 * @throws OCSException
417
	 */
418
	public function members(string $circleId): DataResponse {
419
		try {
420
			$this->setCurrentFederatedUser();
421
422
			return new DataResponse($this->serializeArray($this->memberService->getMembers($circleId)));
423
		} catch (Exception $e) {
424
			throw new OCSException($e->getMessage(), $e->getCode());
425
		}
426
	}
427
428
429
	/**
@@ 460-470 (lines=11) @@
457
	 * @return DataResponse
458
	 * @throws OCSException
459
	 */
460
	public function editDescription(string $circleId, string $value): DataResponse {
461
		try {
462
			$this->setCurrentFederatedUser();
463
464
			$outcome = $this->circleService->updateDescription($circleId, $value);
465
466
			return new DataResponse($this->serializeArray($outcome));
467
		} catch (Exception $e) {
468
			throw new OCSException($e->getMessage(), $e->getCode());
469
		}
470
	}
471
472
473
	/**
@@ 482-492 (lines=11) @@
479
	 * @return DataResponse
480
	 * @throws OCSException
481
	 */
482
	public function editSettings(string $circleId, array $value): DataResponse {
483
		try {
484
			$this->setCurrentFederatedUser();
485
486
			$outcome = $this->circleService->updateSettings($circleId, $value);
487
488
			return new DataResponse($this->serializeArray($outcome));
489
		} catch (Exception $e) {
490
			throw new OCSException($e->getMessage(), $e->getCode());
491
		}
492
	}
493
494
495
	/**
@@ 504-514 (lines=11) @@
501
	 * @return DataResponse
502
	 * @throws OCSException
503
	 */
504
	public function editConfig(string $circleId, int $value): DataResponse {
505
		try {
506
			$this->setCurrentFederatedUser();
507
508
			$outcome = $this->circleService->updateConfig($circleId, $value);
509
510
			return new DataResponse($this->serializeArray($outcome));
511
		} catch (Exception $e) {
512
			throw new OCSException($e->getMessage(), $e->getCode());
513
		}
514
	}
515
516
517
	/**