Code Duplication    Length = 6-7 lines in 3 locations

lib/Service/CirclesService.php 1 location

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

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);
@@ 579-585 (lines=7) @@
576
		string $circleUniqueId, string $name, int $type, string $instance, bool $force = false
577
	): array {
578
579
		if ($force === false) {
580
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
581
			$circle->getHigherViewer()
582
				   ->hasToBeModerator();
583
		} else {
584
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
585
		}
586
587
		$member = $this->membersRequest->forceGetMember($circleUniqueId, $name, $type, $instance);
588