Code Duplication    Length = 10-22 lines in 4 locations

lib/Controller/CirclesController.php 4 locations

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