Code Duplication    Length = 6-7 lines in 3 locations

lib/Service/MembersService.php 2 locations

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

lib/Service/CirclesService.php 1 location

@@ 467-472 (lines=6) @@
464
	 * @throws Exception
465
	 */
466
	public function removeCircle($circleUniqueId, bool $force = false) {
467
		if ($force) {
468
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
469
		} else {
470
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
471
			$this->hasToBeOwner($circle->getHigherViewer());
472
		}
473
474
		// removing a Circle is done only by owner, so can already be done by local user, or admin, or occ
475
		// at this point, we already know that all condition are filled. we can force it.