Code Duplication    Length = 21-21 lines in 2 locations

lib/Service/CirclesService.php 1 location

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

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
	/**