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

lib/Service/CirclesService.php 1 location

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