Code Duplication    Length = 20-22 lines in 3 locations

lib/Controller/CirclesController.php 3 locations

@@ 99-120 (lines=22) @@
96
	 * @internal param string $name
97
	 *
98
	 */
99
	public function details($id) {
100
		try {
101
			$data = $this->circlesService->detailsCircle($id);
102
103
			return $this->success(['circle_id' => $id, 'details' => $data]);
104
		} catch (\Exception $e) {
105
106
			return $this->fail(['circle_id' => $id, 'error' => $e->getMessage()]);
107
		}
108
109
	}
110
111
112
	/**
113
	 * @NoAdminRequired
114
	 * @NoSubAdminRequired
115
	 *
116
	 * @param $id
117
	 *
118
	 * @return DataResponse
119
	 * @internal param string $name
120
	 *
121
	 */
122
	public function join($id) {
123
		try {
@@ 122-141 (lines=20) @@
119
	 * @internal param string $name
120
	 *
121
	 */
122
	public function join($id) {
123
		try {
124
			$data = $this->circlesService->joinCircle($id);
125
126
			return $this->success(['circle_id' => $id, 'member' => $data]);
127
		} catch (\Exception $e) {
128
129
			return $this->fail(['circle_id' => $id, 'error' => $e->getMessage()]);
130
		}
131
	}
132
133
134
	/**
135
	 * @NoAdminRequired
136
	 * @NoSubAdminRequired
137
	 *
138
	 * @param $id
139
	 *
140
	 * @return DataResponse
141
	 * @internal param string $name
142
	 *
143
	 */
144
	public function leave($id) {
@@ 144-163 (lines=20) @@
141
	 * @internal param string $name
142
	 *
143
	 */
144
	public function leave($id) {
145
		try {
146
			$data = $this->circlesService->leaveCircle($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
	/**
158
	 * Convert a Type in String to its Bit Value
159
	 *
160
	 * @param $type
161
	 *
162
	 * @return int
163
	 */
164
	public static function convertTypeStringToBitValue($type) {
165
		if (strtolower($type) === 'personal') {
166
			return Circle::CIRCLES_PERSONAL;