Code Duplication    Length = 28-29 lines in 3 locations

lib/Activity/Provider.php 3 locations

@@ 660-687 (lines=28) @@
657
	 *
658
	 * @return IEvent
659
	 */
660
	private function parseLinkRequestSent($lang, Circle $circle, FederatedLink $link, IEvent $event
661
	) {
662
		if ($circle->getUser()
663
				   ->getUserId() === $this->activityManager->getCurrentUserId()
664
		) {
665
			$event->setRichSubject(
666
				$this->l10n->t('You sent a request to link {circle} with {remote}'),
667
				[
668
					'circle' => $this->generateCircleParameter($circle),
669
					'remote' => $this->generateLinkParameter($link)
670
				]
671
			);
672
		} else {
673
			$event->setRichSubject(
674
				$this->l10n->t('{author} sent a request to link {circle} with {remote}'),
675
				[
676
					'author' => $this->generateUserParameter(
677
						$circle->getUser()
678
							   ->getUserId()
679
					),
680
					'circle' => $this->generateCircleParameter($circle),
681
					'remote' => $this->generateLinkParameter($link)
682
				]
683
			);
684
		}
685
686
		return $event;
687
	}
688
689
690
	/**
@@ 768-796 (lines=29) @@
765
	 *
766
	 * @return IEvent
767
	 */
768
	private function parseLinkRequestRemoved(
769
		$lang, Circle $circle, FederatedLink $link, IEvent $event
770
	) {
771
		if ($circle->getUser()
772
				   ->getUserId() === $this->activityManager->getCurrentUserId()
773
		) {
774
			$event->setRichSubject(
775
				$this->l10n->t('You dismissed the request to link {remote} with {circle}'),
776
				[
777
					'circle' => $this->generateCircleParameter($circle),
778
					'remote' => $this->generateLinkParameter($link)
779
				]
780
			);
781
		} else {
782
			$event->setRichSubject(
783
				$this->l10n->t('{author} dismissed the request to link {remote} with {circle}'),
784
				[
785
					'author' => $this->generateUserParameter(
786
						$circle->getUser()
787
							   ->getUserId()
788
					),
789
					'circle' => $this->generateCircleParameter($circle),
790
					'remote' => $this->generateLinkParameter($link)
791
				]
792
			);
793
		}
794
795
		return $event;
796
	}
797
798
799
	/**
@@ 830-858 (lines=29) @@
827
	 *
828
	 * @return IEvent
829
	 */
830
	private function parseLinkRequestAccepting(
831
		$lang, Circle $circle, FederatedLink $link, IEvent $event
832
	) {
833
		if ($circle->getUser()
834
				   ->getUserId() === $this->activityManager->getCurrentUserId()
835
		) {
836
			$event->setRichSubject(
837
				$this->l10n->t('You accepted the request to link {remote} with {circle}'),
838
				[
839
					'circle' => $this->generateCircleParameter($circle),
840
					'remote' => $this->generateLinkParameter($link)
841
				]
842
			);
843
		} else {
844
			$event->setRichSubject(
845
				$this->l10n->t('{author} accepted the request to link {remote} with {circle}'),
846
				[
847
					'author' => $this->generateUserParameter(
848
						$circle->getUser()
849
							   ->getUserId()
850
					),
851
					'circle' => $this->generateCircleParameter($circle),
852
					'remote' => $this->generateLinkParameter($link)
853
				]
854
			);
855
		}
856
857
		return $event;
858
	}
859
860
861
	/**