Code Duplication    Length = 6-7 lines in 3 locations

lib/Service/MembersService.php 2 locations

@@ 155-161 (lines=7) @@
152
	 * @throws Exception
153
	 */
154
	public function addMember($circleUniqueId, $ident, $type, string $instance, bool $force = false) {
155
		if ($force === true) {
156
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
157
		} else {
158
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
159
			$circle->getHigherViewer()
160
				   ->hasToBeModerator();
161
		}
162
163
		$curr = $this->membersRequest->getMembers($circle->getUniqueId(), $circle->getHigherViewer(), $force);
164
@@ 598-604 (lines=7) @@
595
		string $circleUniqueId, string $name, int $type, string $instance, bool $force = false
596
	): array {
597
598
		if ($force === false) {
599
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
600
			$circle->getHigherViewer()
601
				   ->hasToBeModerator();
602
		} else {
603
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
604
		}
605
606
		$member = $this->membersRequest->forceGetMember($circleUniqueId, $name, $type, $instance);
607

lib/Service/CirclesService.php 1 location

@@ 432-437 (lines=6) @@
429
	 * @throws Exception
430
	 */
431
	public function removeCircle($circleUniqueId, bool $force = false) {
432
		if ($force) {
433
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
434
		} else {
435
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
436
			$this->hasToBeOwner($circle->getHigherViewer());
437
		}
438
439
		// removing a Circle is done only by owner, so can already be done by local user, or admin, or occ
440
		// at this point, we already know that all condition are filled. we can force it.