Code Duplication    Length = 10-22 lines in 5 locations

lib/Controller/CirclesController.php 5 locations

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