Code Duplication    Length = 20-22 lines in 3 locations

lib/Controller/CirclesController.php 3 locations

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