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
		if (!$this->addMassiveMembers($circle, $ident, $type)) {
164
			$this->addSingleMember($circle, $ident, $type, $instance, $force);
@@ 565-571 (lines=7) @@
562
		string $circleUniqueId, string $name, int $type, string $instance, bool $force = false
563
	): array {
564
565
		if ($force === false) {
566
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
567
			$circle->getHigherViewer()
568
				   ->hasToBeModerator();
569
		} else {
570
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
571
		}
572
573
		$member = $this->membersRequest->forceGetMember($circleUniqueId, $name, $type, $instance);
574

lib/Service/CirclesService.php 1 location

@@ 418-423 (lines=6) @@
415
	 * @throws Exception
416
	 */
417
	public function removeCircle($circleUniqueId, bool $force = false) {
418
		if ($force) {
419
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
420
		} else {
421
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
422
			$this->hasToBeOwner($circle->getHigherViewer());
423
		}
424
425
		// removing a Circle is done only by owner, so can already be done by local user, or admin, or occ
426
		// at this point, we already know that all condition are filled. we can force it.