Code Duplication    Length = 12-16 lines in 3 locations

controller/calendarcontroller.php 1 location

@@ 177-191 (lines=15) @@
174
	 * @NoAdminRequired
175
	 * @NoCSRFRequired
176
	 */
177
	public function destroy($id) {
178
		try {
179
			$calendar = $this->calendars->find($id, $this->user->getUID());
180
181
			$this->calendars->delete(
182
				$calendar
183
			);
184
185
			return new JSONResponse([
186
				'message' => 'Calendar was deleted successfully',
187
			]);
188
		} catch (\Exception $ex) {
189
			return $this->handleException($ex);
190
		}
191
	}
192
}

controller/subscriptioncontroller.php 1 location

@@ 191-206 (lines=16) @@
188
	 * @NoAdminRequired
189
	 * @NoCSRFRequired
190
	 */
191
	public function destroy($id) {
192
		try {
193
			$subscription = $this->subscriptions->find(
194
				$id,
195
				$this->user->getUID()
196
			);
197
198
			$this->subscriptions->delete($subscription);
199
200
			return new JSONResponse([
201
				'message' => 'Subscription was deleted successfully',
202
			]);
203
		} catch (\Exception $ex) {
204
			return $this->handleException($ex);
205
		}
206
	}
207
}

controller/timezonecontroller.php 1 location

@@ 86-97 (lines=12) @@
83
	 * @NoAdminRequired
84
	 * @NoCSRFRequired
85
	 */
86
	 public function show($id) {
87
		try {
88
			$tzId = str_replace('-', '/', $id);
89
90
			return $this->timezones->find(
91
				$tzId,
92
				$this->user->getUID()
93
			);
94
		} catch (\Exception $ex) {
95
			return $this->handleException($ex);
96
		}
97
	}
98
99
100
	/**