Code Duplication    Length = 21-21 lines in 2 locations

lib/Service/GroupsService.php 1 location

@@ 97-117 (lines=21) @@
94
	 * @return array
95
	 * @throws \Exception
96
	 */
97
	public function linkGroup($circleUniqueId, $groupId) {
98
99
		try {
100
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
101
			$circle->getHigherViewer()
102
				   ->hasToBeAdmin();
103
104
			$group = $this->getFreshNewMember($circleUniqueId, $groupId);
105
		} catch (\Exception $e) {
106
			throw $e;
107
		}
108
109
		$group->setLevel(Member::LEVEL_MEMBER);
110
		$this->membersRequest->updateGroup($group);
111
112
		$this->eventsService->onGroupLink($circle, $group);
113
114
		return $this->membersRequest->getGroupsFromCircle(
115
			$circleUniqueId, $circle->getHigherViewer()
116
		);
117
	}
118
119
120
	/**

lib/Service/CirclesService.php 1 location

@@ 316-336 (lines=21) @@
313
	 * @return null|Member
314
	 * @throws \Exception
315
	 */
316
	public function leaveCircle($circleUniqueId) {
317
318
		try {
319
			$circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId);
320
			$member = $circle->getViewer();
321
322
			$member->hasToBeMemberOrAlmost();
323
			$member->cantBeOwner();
324
325
			$this->eventsService->onMemberLeaving($circle, $member);
326
327
			$member->setStatus(Member::STATUS_NONMEMBER);
328
			$member->setLevel(Member::LEVEL_NONE);
329
			$this->membersRequest->updateMember($member);
330
		} catch (\Exception $e) {
331
			throw $e;
332
		}
333
334
		return $member;
335
	}
336
337
338
	/**
339
	 * destroy a circle.