Code Duplication    Length = 6-7 lines in 3 locations

lib/Service/CirclesService.php 1 location

@@ 410-415 (lines=6) @@
407
	 */
408
	public function removeCircle($circleUniqueId, bool $force = false) {
409
410
		if ($force) {
411
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
412
		} else {
413
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
414
			$this->hasToBeOwner($circle->getHigherViewer());
415
		}
416
417
418
		$this->eventsService->onCircleDestruction($circle);

lib/Service/MembersService.php 2 locations

@@ 153-159 (lines=7) @@
150
	 */
151
	public function addMember($circleUniqueId, $ident, $type, bool $force = false) {
152
153
		if ($force === true) {
154
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
155
		} else {
156
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
157
			$circle->getHigherViewer()
158
				   ->hasToBeModerator();
159
		}
160
161
		if (!$this->addMassiveMembers($circle, $ident, $type)) {
162
			$this->addSingleMember($circle, $ident, $type);
@@ 627-633 (lines=7) @@
624
	 */
625
	public function removeMember($circleUniqueId, $name, $type, bool $force = false) {
626
627
		if ($force === false) {
628
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
629
			$circle->getHigherViewer()
630
				   ->hasToBeModerator();
631
		} else {
632
			$circle = $this->circlesRequest->forceGetCircle($circleUniqueId);
633
		}
634
635
		$member = $this->membersRequest->forceGetMember($circleUniqueId, $name, $type);
636
		$member->hasToBeMemberOrAlmost();