Code Duplication    Length = 10-20 lines in 4 locations

lib/Controller/CirclesController.php 4 locations

@@ 121-131 (lines=11) @@
118
	 * @internal param string $name
119
	 *
120
	 */
121
	public function settings($id, $settings) {
122
		try {
123
			$circle = $this->circlesService->settingsCircle($id, $settings);
124
125
			return $this->success(['circle_id' => $id, 'details' => $circle]);
126
		} catch (\Exception $e) {
127
128
			return $this->fail(['circle_id' => $id, 'error' => $e->getMessage()]);
129
		}
130
131
	}
132
133
134
	/**
@@ 144-163 (lines=20) @@
141
	 * @internal param string $name
142
	 *
143
	 */
144
	public function join($id) {
145
		try {
146
			$data = $this->circlesService->joinCircle($id);
147
148
			return $this->success(['circle_id' => $id, 'member' => $data]);
149
		} catch (\Exception $e) {
150
151
			return $this->fail(['circle_id' => $id, 'error' => $e->getMessage()]);
152
		}
153
	}
154
155
156
	/**
157
	 * @NoAdminRequired
158
	 * @NoSubAdminRequired
159
	 *
160
	 * @param $id
161
	 *
162
	 * @return DataResponse
163
	 * @internal param string $name
164
	 *
165
	 */
166
	public function leave($id) {
@@ 166-185 (lines=20) @@
163
	 * @internal param string $name
164
	 *
165
	 */
166
	public function leave($id) {
167
		try {
168
			$data = $this->circlesService->leaveCircle($id);
169
170
			return $this->success(['circle_id' => $id, 'member' => $data]);
171
		} catch (\Exception $e) {
172
173
			return $this->fail(['circle_id' => $id, 'error' => $e->getMessage()]);
174
		}
175
176
	}
177
178
179
	/**
180
	 * @NoAdminRequired
181
	 * @NoSubAdminRequired
182
	 *
183
	 * @param $id
184
	 *
185
	 * @return DataResponse
186
	 * @internal param string $name
187
	 *
188
	 */
@@ 189-198 (lines=10) @@
186
	 * @internal param string $name
187
	 *
188
	 */
189
	public function destroy($id) {
190
		try {
191
			$this->circlesService->removeCircle($id);
192
193
			return $this->success(['circle_id' => $id]);
194
		} catch (\Exception $e) {
195
			return $this->fail(['circle_id' => $id, 'error' => $e->getMessage()]);
196
		}
197
	}
198
199
200
	/**
201
	 * link()