Code Duplication    Length = 22-27 lines in 4 locations

lib/Activity/Provider.php 4 locations

@@ 172-198 (lines=27) @@
169
	 *
170
	 * @return IEvent
171
	 */
172
	private function parseCircleCreate($lang, Circle $circle, IEvent $event) {
173
		if ($circle->getOwner()
174
				   ->getUserId() === $this->activityManager->getCurrentUserId()
175
		) {
176
			$event->setRichSubject(
177
				$this->l10n->t('You created the circle {circle}'),
178
				['circle' => $this->generateCircleParameter($circle)]
179
			);
180
181
		} else {
182
			$event->setRichSubject(
183
				$this->l10n->t('{author} created the circle {circle}'),
184
				[
185
					'author' => $author = $this->generateUserParameter(
186
						$circle->getOwner()
187
							   ->getUserId()
188
					),
189
					'circle' => $this->generateCircleParameter($circle)
190
				]
191
			);
192
		}
193
194
		return $event;
195
	}
196
197
198
	/**
199
	 * @param string $lang
200
	 * @param Circle $circle
201
	 * @param IEvent $event
@@ 205-230 (lines=26) @@
202
	 *
203
	 * @return IEvent
204
	 */
205
	private function parseCircleDelete($lang, Circle $circle, IEvent $event) {
206
		if ($circle->getOwner()
207
				   ->getUserId() === $this->activityManager->getCurrentUserId()
208
		) {
209
			$event->setRichSubject(
210
				$this->l10n->t('You deleted {circle}'),
211
				['circle' => $this->generateCircleParameter($circle)]
212
			);
213
		} else {
214
			$event->setRichSubject(
215
				$this->l10n->t('{author} deleted {circle}'),
216
				[
217
					'author' => $this->generateUserParameter(
218
						$circle->getOwner()
219
							   ->getUserId()
220
					),
221
					'circle' => $this->generateCircleParameter($circle)
222
				]
223
			);
224
		}
225
226
		return $event;
227
	}
228
229
230
	/**
231
	 * @param string $lang
232
	 * @param Circle $circle
233
	 * @param Member $member
@@ 321-342 (lines=22) @@
318
	 *
319
	 * @return IEvent
320
	 */
321
	private function parseMemberJoin($lang, Circle $circle, Member $member, IEvent $event) {
322
		if ($circle->getUser()
323
				   ->getUserId() === $this->activityManager->getCurrentUserId()
324
		) {
325
			$event->setRichSubject(
326
				$this->l10n->t('You joined {circle}'),
327
				['circle' => $this->generateCircleParameter($circle)]
328
			);
329
330
		} else {
331
			$event->setRichSubject(
332
				$this->l10n->t(
333
					'{member} has joined the circle {circle}'
334
				), [
335
					'circle' => $this->generateCircleParameter($circle),
336
					'member' => $this->generateMemberParameter($member)
337
				]
338
			);
339
		}
340
341
		return $event;
342
	}
343
344
345
	/**
@@ 405-426 (lines=22) @@
402
	 *
403
	 * @return IEvent
404
	 */
405
	private function parseMemberLeft($lang, Circle $circle, Member $member, IEvent $event) {
406
		if ($circle->getUser()
407
				   ->getUserId() === $this->activityManager->getCurrentUserId()
408
		) {
409
			$event->setRichSubject(
410
				$this->l10n->t('You left {circle}'),
411
				['circle' => $this->generateCircleParameter($circle)]
412
			);
413
414
		} else {
415
			$event->setRichSubject(
416
				$this->l10n->t(
417
					'{member} has left {circle}'
418
				), [
419
					'circle' => $this->generateCircleParameter($circle),
420
					'member' => $this->generateMemberParameter($member)
421
				]
422
			);
423
		}
424
425
		return $event;
426
	}
427
428
429
	/**