Code Duplication    Length = 21-22 lines in 4 locations

lib/Activity/Provider.php 4 locations

@@ 296-317 (lines=22) @@
293
	 *
294
	 * @return IEvent
295
	 */
296
	private function parseMemberRequestInvitation(
297
		$lang, Circle $circle, Member $member, IEvent $event
298
	) {
299
		if ($member->getUserId() === $this->activityManager->getCurrentUserId()) {
300
			$event->setRichSubject(
301
				$this->l10n->t('You requested an invitation to {circle}'),
302
				['circle' => $this->generateCircleParameter($circle)]
303
			);
304
305
		} else {
306
			$event->setRichSubject(
307
				$this->l10n->t(
308
					'{author} has requested an invitation into {circle}'
309
				), [
310
					'author' => $this->generateMemberParameter($member),
311
					'circle' => $this->generateCircleParameter($circle)
312
				]
313
			);
314
		}
315
316
		return $event;
317
	}
318
319
320
	/**
@@ 328-349 (lines=22) @@
325
	 *
326
	 * @return IEvent
327
	 */
328
	private function parseMemberJoin($lang, Circle $circle, Member $member, IEvent $event) {
329
		if ($circle->getUser()
330
				   ->getUserId() === $this->activityManager->getCurrentUserId()
331
		) {
332
			$event->setRichSubject(
333
				$this->l10n->t('You joined {circle}'),
334
				['circle' => $this->generateCircleParameter($circle)]
335
			);
336
337
		} else {
338
			$event->setRichSubject(
339
				$this->l10n->t(
340
					'{member} has joined the circle {circle}'
341
				), [
342
					'circle' => $this->generateCircleParameter($circle),
343
					'member' => $this->generateMemberParameter($member)
344
				]
345
			);
346
		}
347
348
		return $event;
349
	}
350
351
352
	/**
@@ 412-433 (lines=22) @@
409
	 *
410
	 * @return IEvent
411
	 */
412
	private function parseMemberLeft($lang, Circle $circle, Member $member, IEvent $event) {
413
		if ($circle->getUser()
414
				   ->getUserId() === $this->activityManager->getCurrentUserId()
415
		) {
416
			$event->setRichSubject(
417
				$this->l10n->t('You left {circle}'),
418
				['circle' => $this->generateCircleParameter($circle)]
419
			);
420
421
		} else {
422
			$event->setRichSubject(
423
				$this->l10n->t(
424
					'{member} has left {circle}'
425
				), [
426
					'circle' => $this->generateCircleParameter($circle),
427
					'member' => $this->generateMemberParameter($member)
428
				]
429
			);
430
		}
431
432
		return $event;
433
	}
434
435
436
	/**
@@ 557-577 (lines=21) @@
554
	 *
555
	 * @return IEvent
556
	 */
557
	private function parseMemberOwner($lang, Circle $circle, Member $member, IEvent $event) {
558
		if ($member->getUserId() === $this->activityManager->getCurrentUserId()
559
		) {
560
			$event->setRichSubject(
561
				$this->l10n->t('You are the new owner of {circle}'),
562
				['circle' => $this->generateCircleParameter($circle)]
563
			);
564
565
		} else {
566
			$event->setRichSubject(
567
				$this->l10n->t(
568
					'{member} is the new owner of {circle}'
569
				), [
570
					'circle' => $this->generateCircleParameter($circle),
571
					'member' => $this->generateMemberParameter($member)
572
				]
573
			);
574
		}
575
576
		return $event;
577
	}
578
579
580
	private function generateMemberParameter(