Code Duplication    Length = 12-13 lines in 4 locations

apps/files_sharing/lib/External/Manager.php 2 locations

@@ 333-345 (lines=13) @@
330
	 */
331
	protected function tryOCMEndPoint($remoteDomain, $token, $remoteId, $feedback) {
332
		switch ($feedback) {
333
			case 'accept':
334
				$notification = $this->cloudFederationFactory->getCloudFederationNotification();
335
				$notification->setMessage(
336
					'SHARE_ACCEPTED',
337
					'file',
338
					$remoteId,
339
					[
340
						'sharedSecret' => $token,
341
						'message' => 'Recipient accept the share'
342
					]
343
344
				);
345
				return $this->cloudFederationProviderManager->sendNotification($remoteDomain, $notification);
346
			case 'decline':
347
				$notification = $this->cloudFederationFactory->getCloudFederationNotification();
348
				$notification->setMessage(
@@ 346-358 (lines=13) @@
343
344
				);
345
				return $this->cloudFederationProviderManager->sendNotification($remoteDomain, $notification);
346
			case 'decline':
347
				$notification = $this->cloudFederationFactory->getCloudFederationNotification();
348
				$notification->setMessage(
349
					'SHARE_DECLINED',
350
					'file',
351
					$remoteId,
352
					[
353
						'sharedSecret' => $token,
354
						'message' => 'Recipient declined the share'
355
					]
356
357
				);
358
				return $this->cloudFederationProviderManager->sendNotification($remoteDomain, $notification);
359
		}
360
361
		return false;

apps/federatedfilesharing/lib/Notifications.php 2 locations

@@ 413-424 (lines=12) @@
410
					]
411
				);
412
				return $this->federationProviderManager->sendNotification($remoteDomain, $notification);
413
			case 'unshare':
414
				//owner unshares the file from the recipient again
415
				$notification = $this->cloudFederationFactory->getCloudFederationNotification();
416
				$notification->setMessage('SHARE_UNSHARED',
417
					'file',
418
					$fields['remoteId'],
419
					[
420
						'sharedSecret' => $fields['token'],
421
						'messgage' => 'file is no longer shared with you'
422
					]
423
				);
424
				return $this->federationProviderManager->sendNotification($remoteDomain, $notification);
425
			case 'reshare_undo':
426
				// if a reshare was unshared we send the information to the initiator/owner
427
				$notification = $this->cloudFederationFactory->getCloudFederationNotification();
@@ 425-436 (lines=12) @@
422
					]
423
				);
424
				return $this->federationProviderManager->sendNotification($remoteDomain, $notification);
425
			case 'reshare_undo':
426
				// if a reshare was unshared we send the information to the initiator/owner
427
				$notification = $this->cloudFederationFactory->getCloudFederationNotification();
428
				$notification->setMessage('RESHARE_UNDO',
429
					'file',
430
					$fields['remoteId'],
431
					[
432
						'sharedSecret' => $fields['token'],
433
						'message' => 'reshare was revoked'
434
					]
435
				);
436
				return $this->federationProviderManager->sendNotification($remoteDomain, $notification);
437
		}
438
439
		return false;