Code Duplication    Length = 21-22 lines in 4 locations

lib/Activity/Provider.php 4 locations

@@ 368-389 (lines=22) @@
365
	 *
366
	 * @return IEvent
367
	 */
368
	private function parseMemberRequestInvitation(
369
		$lang, Circle $circle, Member $member, IEvent $event
370
	) {
371
		if ($member->getUserId() === $this->activityManager->getCurrentUserId()) {
372
			$event->setRichSubject(
373
				$this->l10n->t('You requested an invitation to {circle}'),
374
				['circle' => $this->generateCircleParameter($circle)]
375
			);
376
377
		} else {
378
			$event->setRichSubject(
379
				$this->l10n->t(
380
					'{author} has requested an invitation into {circle}'
381
				), [
382
					'author' => $this->generateMemberParameter($member),
383
					'circle' => $this->generateCircleParameter($circle)
384
				]
385
			);
386
		}
387
388
		return $event;
389
	}
390
391
392
	/**
@@ 400-421 (lines=22) @@
397
	 *
398
	 * @return IEvent
399
	 */
400
	private function parseMemberJoin($lang, Circle $circle, Member $member, IEvent $event) {
401
		if ($circle->getUser()
402
				   ->getUserId() === $this->activityManager->getCurrentUserId()
403
		) {
404
			$event->setRichSubject(
405
				$this->l10n->t('You joined {circle}'),
406
				['circle' => $this->generateCircleParameter($circle)]
407
			);
408
409
		} else {
410
			$event->setRichSubject(
411
				$this->l10n->t(
412
					'{member} has joined the circle {circle}'
413
				), [
414
					'circle' => $this->generateCircleParameter($circle),
415
					'member' => $this->generateMemberParameter($member)
416
				]
417
			);
418
		}
419
420
		return $event;
421
	}
422
423
424
	/**
@@ 484-505 (lines=22) @@
481
	 *
482
	 * @return IEvent
483
	 */
484
	private function parseMemberLeft($lang, Circle $circle, Member $member, IEvent $event) {
485
		if ($circle->getUser()
486
				   ->getUserId() === $this->activityManager->getCurrentUserId()
487
		) {
488
			$event->setRichSubject(
489
				$this->l10n->t('You left {circle}'),
490
				['circle' => $this->generateCircleParameter($circle)]
491
			);
492
493
		} else {
494
			$event->setRichSubject(
495
				$this->l10n->t(
496
					'{member} has left {circle}'
497
				), [
498
					'circle' => $this->generateCircleParameter($circle),
499
					'member' => $this->generateMemberParameter($member)
500
				]
501
			);
502
		}
503
504
		return $event;
505
	}
506
507
508
	/**
@@ 629-649 (lines=21) @@
626
	 *
627
	 * @return IEvent
628
	 */
629
	private function parseMemberOwner($lang, Circle $circle, Member $member, IEvent $event) {
630
		if ($member->getUserId() === $this->activityManager->getCurrentUserId()
631
		) {
632
			$event->setRichSubject(
633
				$this->l10n->t('You are the new owner of {circle}'),
634
				['circle' => $this->generateCircleParameter($circle)]
635
			);
636
637
		} else {
638
			$event->setRichSubject(
639
				$this->l10n->t(
640
					'{member} is the new owner of {circle}'
641
				), [
642
					'circle' => $this->generateCircleParameter($circle),
643
					'member' => $this->generateMemberParameter($member)
644
				]
645
			);
646
		}
647
648
		return $event;
649
	}
650
651
652
	/**