Code Duplication    Length = 12-22 lines in 4 locations

lib/Controller/CirclesController.php 4 locations

@@ 138-157 (lines=20) @@
135
	 *
136
	 * @return DataResponse
137
	 */
138
	public function join($uniqueId) {
139
		try {
140
			$data = $this->circlesService->joinCircle($uniqueId);
141
142
			return $this->success(['circle_id' => $uniqueId, 'member' => $data]);
143
		} catch (\Exception $e) {
144
145
			return $this->fail(['circle_id' => $uniqueId, 'error' => $e->getMessage()]);
146
		}
147
	}
148
149
150
	/**
151
	 * @NoAdminRequired
152
	 * @NoSubAdminRequired
153
	 *
154
	 * @param string $uniqueId
155
	 *
156
	 * @return DataResponse
157
	 */
158
	public function leave($uniqueId) {
159
		try {
160
			$data = $this->circlesService->leaveCircle($uniqueId);
@@ 158-177 (lines=20) @@
155
	 *
156
	 * @return DataResponse
157
	 */
158
	public function leave($uniqueId) {
159
		try {
160
			$data = $this->circlesService->leaveCircle($uniqueId);
161
162
			return $this->success(['circle_id' => $uniqueId, 'member' => $data]);
163
		} catch (\Exception $e) {
164
165
			return $this->fail(['circle_id' => $uniqueId, 'error' => $e->getMessage()]);
166
		}
167
168
	}
169
170
171
	/**
172
	 * @NoAdminRequired
173
	 * @NoSubAdminRequired
174
	 *
175
	 * @param string $uniqueId
176
	 *
177
	 * @return DataResponse
178
	 */
179
	public function destroy($uniqueId) {
180
		try {
@@ 94-115 (lines=22) @@
91
	 *
92
	 * @return DataResponse
93
	 */
94
	public function details($uniqueId) {
95
		try {
96
			$circle = $this->circlesService->detailsCircle($uniqueId);
97
98
			return $this->success(['circle_id' => $uniqueId, 'details' => $circle]);
99
		} catch (\Exception $e) {
100
101
			return $this->fail(['circle_id' => $uniqueId, 'error' => $e->getMessage()]);
102
		}
103
104
	}
105
106
107
	/**
108
	 * @NoAdminRequired
109
	 * @NoSubAdminRequired
110
	 *
111
	 * @param string $uniqueId
112
	 * @param array $settings
113
	 *
114
	 * @return DataResponse
115
	 */
116
	public function settings($uniqueId, $settings) {
117
		try {
118
			$this->verifyCreationName($settings['circle_name']);
@@ 116-127 (lines=12) @@
113
	 *
114
	 * @return DataResponse
115
	 */
116
	public function settings($uniqueId, $settings) {
117
		try {
118
			$this->verifyCreationName($settings['circle_name']);
119
			$circle = $this->circlesService->settingsCircle($uniqueId, $settings);
120
121
			return $this->success(['circle_id' => $uniqueId, 'details' => $circle]);
122
		} catch (\Exception $e) {
123
124
			return $this->fail(['circle_id' => $uniqueId, 'error' => $e->getMessage()]);
125
		}
126
127
	}
128
129
130
	/**