Code Duplication    Length = 22-22 lines in 2 locations

apps/federatedfilesharing/lib/Controller/RequestHandlerController.php 2 locations

@@ 255-276 (lines=22) @@
252
	 * @throws ShareNotFound
253
	 * @throws \OC\HintException
254
	 */
255
	public function acceptShare($id) {
256
257
		$token = isset($_POST['token']) ? $_POST['token'] : null;
258
259
		$notification = [
260
			'sharedSecret' => $token,
261
			'message' => 'Recipient accept the share'
262
		];
263
264
		try {
265
			$provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file');
266
			$provider->notificationReceived('SHARE_ACCEPTED', $id, $notification);
267
		} catch (ProviderDoesNotExistsException $e) {
268
			throw new OCSException('Server does not support federated cloud sharing', 503);
269
		} catch (ShareNotFound $e) {
270
			$this->logger->debug('Share not found: ' . $e->getMessage());
271
		} catch (\Exception $e) {
272
			$this->logger->debug('internal server error, can not process notification: ' . $e->getMessage());
273
		}
274
275
		return new Http\DataResponse();
276
	}
277
278
	/**
279
	 * @NoCSRFRequired
@@ 288-309 (lines=22) @@
285
	 * @return Http\DataResponse
286
	 * @throws OCSException
287
	 */
288
	public function declineShare($id) {
289
290
		$token = isset($_POST['token']) ? $_POST['token'] : null;
291
292
		$notification = [
293
			'sharedSecret' => $token,
294
			'message' => 'Recipient declined the share'
295
		];
296
297
		try {
298
			$provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file');
299
			$provider->notificationReceived('SHARE_DECLINED', $id, $notification);
300
		} catch (ProviderDoesNotExistsException $e) {
301
			throw new OCSException('Server does not support federated cloud sharing', 503);
302
		} catch (ShareNotFound $e) {
303
			$this->logger->debug('Share not found: ' . $e->getMessage());
304
		} catch (\Exception $e) {
305
			$this->logger->debug('internal server error, can not process notification: ' . $e->getMessage());
306
		}
307
308
		return new Http\DataResponse();
309
	}
310
311
	/**
312
	 * @NoCSRFRequired