Code Duplication    Length = 9-12 lines in 11 locations

lib/Controller/LocalController.php 11 locations

@@ 158-167 (lines=10) @@
155
	 * @return DataResponse
156
	 * @throws OCSException
157
	 */
158
	public function destroy(string $circleId): DataResponse {
159
		try {
160
			$this->setCurrentFederatedUser();
161
			$circle = $this->circleService->destroy($circleId);
162
163
			return new DataResponse($this->serializeArray($circle));
164
		} catch (Exception $e) {
165
			throw new OcsException($e->getMessage(), $e->getCode());
166
		}
167
	}
168
169
170
	/**
@@ 178-186 (lines=9) @@
175
	 * @return DataResponse
176
	 * @throws OCSException
177
	 */
178
	public function search(string $term): DataResponse {
179
		try {
180
			$this->setCurrentFederatedUser();
181
182
			return new DataResponse($this->serializeArray($this->searchService->search($term)));
183
		} catch (Exception $e) {
184
			throw new OcsException($e->getMessage(), $e->getCode());
185
		}
186
	}
187
188
189
	/**
@@ 197-205 (lines=9) @@
194
	 * @return DataResponse
195
	 * @throws OCSException
196
	 */
197
	public function circleDetails(string $circleId): DataResponse {
198
		try {
199
			$this->setCurrentFederatedUser();
200
201
			return new DataResponse($this->serialize($this->circleService->getCircle($circleId)));
202
		} catch (Exception $e) {
203
			throw new OcsException($e->getMessage(), $e->getCode());
204
		}
205
	}
206
207
208
	/**
@@ 282-291 (lines=10) @@
279
	 * @return DataResponse
280
	 * @throws OCSException
281
	 */
282
	public function circleJoin(string $circleId): DataResponse {
283
		try {
284
			$this->setCurrentFederatedUser();
285
			$result = $this->circleService->circleJoin($circleId);
286
287
			return new DataResponse($this->serializeArray($result));
288
		} catch (Exception $e) {
289
			throw new OCSException($e->getMessage(), $e->getCode());
290
		}
291
	}
292
293
294
	/**
@@ 302-311 (lines=10) @@
299
	 * @return DataResponse
300
	 * @throws OCSException
301
	 */
302
	public function circleLeave(string $circleId): DataResponse {
303
		try {
304
			$this->setCurrentFederatedUser();
305
			$result = $this->circleService->circleLeave($circleId);
306
307
			return new DataResponse($this->serializeArray($result));
308
		} catch (Exception $e) {
309
			throw new OCSException($e->getMessage(), $e->getCode());
310
		}
311
	}
312
313
314
	/**
@@ 352-363 (lines=12) @@
349
	 * @return DataResponse
350
	 * @throws OCSException
351
	 */
352
	public function memberRemove(string $circleId, string $memberId): DataResponse {
353
		try {
354
			$this->setCurrentFederatedUser();
355
			$this->memberService->getMemberById($memberId, $circleId);
356
357
			$result = $this->memberService->removeMember($memberId);
358
359
			return new DataResponse($this->serializeArray($result));
360
		} catch (Exception $e) {
361
			throw new OCSException($e->getMessage(), $e->getCode());
362
		}
363
	}
364
365
366
	/**
@@ 391-399 (lines=9) @@
388
	 * @return DataResponse
389
	 * @throws OCSException
390
	 */
391
	public function members(string $circleId): DataResponse {
392
		try {
393
			$this->setCurrentFederatedUser();
394
395
			return new DataResponse($this->serializeArray($this->memberService->getMembers($circleId)));
396
		} catch (Exception $e) {
397
			throw new OCSException($e->getMessage(), $e->getCode());
398
		}
399
	}
400
401
402
	/**
@@ 411-421 (lines=11) @@
408
	 * @return DataResponse
409
	 * @throws OCSException
410
	 */
411
	public function editDisplayName(string $circleId, string $value): DataResponse {
412
		try {
413
			$this->setCurrentFederatedUser();
414
415
			$outcome = $this->circleService->updateDisplayName($circleId, $value);
416
417
			return new DataResponse($this->serializeArray($outcome));
418
		} catch (Exception $e) {
419
			throw new OCSException($e->getMessage(), $e->getCode());
420
		}
421
	}
422
423
424
	/**
@@ 433-443 (lines=11) @@
430
	 * @return DataResponse
431
	 * @throws OCSException
432
	 */
433
	public function editDescription(string $circleId, string $value): DataResponse {
434
		try {
435
			$this->setCurrentFederatedUser();
436
437
			$outcome = $this->circleService->updateDescription($circleId, $value);
438
439
			return new DataResponse($this->serializeArray($outcome));
440
		} catch (Exception $e) {
441
			throw new OCSException($e->getMessage(), $e->getCode());
442
		}
443
	}
444
445
446
	/**
@@ 455-465 (lines=11) @@
452
	 * @return DataResponse
453
	 * @throws OCSException
454
	 */
455
	public function editSettings(string $circleId, array $value): DataResponse {
456
		try {
457
			$this->setCurrentFederatedUser();
458
459
			$outcome = $this->circleService->updateSettings($circleId, $value);
460
461
			return new DataResponse($this->serializeArray($outcome));
462
		} catch (Exception $e) {
463
			throw new OCSException($e->getMessage(), $e->getCode());
464
		}
465
	}
466
467
468
	/**
@@ 477-487 (lines=11) @@
474
	 * @return DataResponse
475
	 * @throws OCSException
476
	 */
477
	public function editConfig(string $circleId, int $value): DataResponse {
478
		try {
479
			$this->setCurrentFederatedUser();
480
481
			$outcome = $this->circleService->updateConfig($circleId, $value);
482
483
			return new DataResponse($this->serializeArray($outcome));
484
		} catch (Exception $e) {
485
			throw new OCSException($e->getMessage(), $e->getCode());
486
		}
487
	}
488
489
490
	/**