Code Duplication    Length = 11-16 lines in 21 locations

lib/Activity/ProviderSubjectCircle.php 2 locations

@@ 46-58 (lines=13) @@
43
	 *
44
	 * @throws FakeException
45
	 */
46
	public function parseSubjectCircleCreate(IEvent &$event, Circle $circle) {
47
		if ($event->getSubject() !== 'circle_create') {
48
			return;
49
		}
50
51
		$this->parseCircleEvent(
52
			$event, $circle, null,
53
			$this->l10n->t('You created the circle {circle}'),
54
			$this->l10n->t('{author} created the circle {circle}')
55
		);
56
57
		throw new FakeException();
58
	}
59
60
61
	/**
@@ 67-79 (lines=13) @@
64
	 *
65
	 * @throws FakeException
66
	 */
67
	public function parseSubjectCircleDelete(IEvent &$event, Circle $circle) {
68
		if ($event->getSubject() !== 'circle_delete') {
69
			return;
70
		}
71
72
		$this->parseCircleEvent(
73
			$event, $circle, null,
74
			$this->l10n->t('You deleted {circle}'),
75
			$this->l10n->t('{author} deleted {circle}')
76
		);
77
78
		throw new FakeException();
79
	}
80
81
82
}

lib/Activity/ProviderSubjectGroup.php 2 locations

@@ 47-58 (lines=12) @@
44
	 *
45
	 * @throws FakeException
46
	 */
47
	public function parseGroupLink(IEvent &$event, Circle $circle, Member $group) {
48
		if ($event->getSubject() !== 'group_link') {
49
			return;
50
		}
51
52
		$this->parseCircleMemberEvent(
53
			$event, $circle, $group,
54
			$this->l10n->t('You linked {group} to {circle}'),
55
			$this->l10n->t('{group} has been linked to {circle} by {author}')
56
		);
57
		throw new FakeException();
58
	}
59
60
61
	/**
@@ 68-79 (lines=12) @@
65
	 *
66
	 * @throws FakeException
67
	 */
68
	public function parseGroupUnlink(IEvent &$event, Circle $circle, Member $group) {
69
		if ($event->getSubject() !== 'group_unlink') {
70
			return;
71
		}
72
		$this->parseCircleMemberEvent(
73
			$event, $circle, $group,
74
			$this->l10n->t('You unlinked {group} from {circle}'),
75
			$this->l10n->t('{group} has been unlinked from {circle} by {author}')
76
		);
77
78
		throw new FakeException();
79
	}
80
81
82
	/**

lib/Activity/ProviderSubjectLink.php 11 locations

@@ 47-59 (lines=13) @@
44
	 *
45
	 * @throws FakeException
46
	 */
47
	public function parseLinkRequestSent(IEvent &$event, Circle $circle, FederatedLink $remote) {
48
		if ($event->getSubject() !== 'link_request_sent') {
49
			return;
50
		}
51
52
		$this->parseCircleEvent(
53
			$event, $circle, $remote,
54
			$this->l10n->t('You sent a request to link {circle} with {remote}'),
55
			$this->l10n->t('{author} sent a request to link {circle} with {remote}')
56
		);
57
58
		throw new FakeException();
59
	}
60
61
62
	/**
@@ 69-79 (lines=11) @@
66
	 *
67
	 * @throws FakeException
68
	 */
69
	public function parseLinkRequestReceived(IEvent &$event, Circle $circle, FederatedLink $remote) {
70
		if ($event->getSubject() !== 'link_request_received') {
71
			return;
72
		}
73
74
		$this->parseLinkEvent(
75
			$event, $circle, $remote, $this->l10n->t('{remote} requested a link with {circle}')
76
		);
77
78
		throw new FakeException();
79
	}
80
81
82
	/**
@@ 89-100 (lines=12) @@
86
	 *
87
	 * @throws FakeException
88
	 */
89
	public function parseLinkRequestRejected(IEvent &$event, Circle $circle, FederatedLink $remote) {
90
		if ($event->getSubject() !== 'link_request_rejected') {
91
			return;
92
		}
93
94
		$this->parseLinkEvent(
95
			$event, $circle, $remote,
96
			$this->l10n->t('The request to link {circle} with {remote} has been rejected')
97
		);
98
99
		throw new FakeException();
100
	}
101
102
103
	/**
@@ 110-123 (lines=14) @@
107
	 *
108
	 * @throws FakeException
109
	 */
110
	public function parseLinkRequestCanceled(IEvent &$event, Circle $circle, FederatedLink $remote) {
111
		if ($event->getSubject() !== 'link_request_canceled') {
112
			return;
113
		}
114
115
		$this->parseLinkEvent(
116
			$event, $circle, $remote,
117
			$this->l10n->t(
118
				'The request to link {remote} with {circle} has been canceled remotely'
119
			)
120
		);
121
122
		throw new FakeException();
123
	}
124
125
126
	/**
@@ 133-144 (lines=12) @@
130
	 *
131
	 * @throws FakeException
132
	 */
133
	public function parseLinkRequestAccepted(IEvent &$event, Circle $circle, FederatedLink $remote) {
134
		if ($event->getSubject() !== 'link_request_accepted') {
135
			return;
136
		}
137
138
		$this->parseLinkEvent(
139
			$event, $circle, $remote,
140
			$this->l10n->t('The request to link {circle} with {remote} has been accepted')
141
		);
142
143
		throw new FakeException();
144
	}
145
146
147
	/**
@@ 154-166 (lines=13) @@
151
	 *
152
	 * @throws FakeException
153
	 */
154
	public function parseLinkRequestRemoved(IEvent &$event, Circle $circle, FederatedLink $remote) {
155
		if ($event->getSubject() !== 'link_request_removed') {
156
			return;
157
		}
158
159
		$this->parseCircleEvent(
160
			$event, $circle, $remote,
161
			$this->l10n->t('You dismissed the request to link {remote} with {circle}'),
162
			$this->l10n->t('{author} dismissed the request to link {remote} with {circle}')
163
		);
164
165
		throw new FakeException();
166
	}
167
168
169
	/**
@@ 176-188 (lines=13) @@
173
	 *
174
	 * @throws FakeException
175
	 */
176
	public function parseLinkRequestCanceling(IEvent &$event, Circle $circle, FederatedLink $remote) {
177
		if ($event->getSubject() !== 'link_request_canceling') {
178
			return;
179
		}
180
181
		$this->parseCircleEvent(
182
			$event, $circle, $remote,
183
			$this->l10n->t('You canceled the request to link {circle} with {remote}'),
184
			$this->l10n->t('{author} canceled the request to link {circle} with {remote}')
185
		);
186
187
		throw new FakeException();
188
	}
189
190
191
	/**
@@ 198-210 (lines=13) @@
195
	 *
196
	 * @throws FakeException
197
	 */
198
	public function parseLinkRequestAccepting(IEvent &$event, Circle $circle, FederatedLink $remote) {
199
		if ($event->getSubject() !== 'link_request_accepting') {
200
			return;
201
		}
202
203
		$this->parseCircleEvent(
204
			$event, $circle, $remote,
205
			$this->l10n->t('You accepted the request to link {remote} with {circle}'),
206
			$this->l10n->t('{author} accepted the request to link {remote} with {circle}')
207
		);
208
209
		throw new FakeException();
210
	}
211
212
213
	/**
@@ 220-231 (lines=12) @@
217
	 *
218
	 * @throws FakeException
219
	 */
220
	public function parseLinkUp(IEvent &$event, Circle $circle, FederatedLink $remote) {
221
		if ($event->getSubject() !== 'link_up') {
222
			return;
223
		}
224
225
		$this->parseLinkEvent(
226
			$event, $circle, $remote,
227
			$this->l10n->t('A link between {circle} and {remote} is now up and running')
228
		);
229
230
		throw new FakeException();
231
	}
232
233
234
	/**
@@ 241-254 (lines=14) @@
238
	 *
239
	 * @throws FakeException
240
	 */
241
	public function parseLinkDown(IEvent &$event, Circle $circle, FederatedLink $remote) {
242
		if ($event->getSubject() !== 'link_down') {
243
			return;
244
		}
245
246
		$this->parseLinkEvent(
247
			$event, $circle, $remote,
248
			$this->l10n->t(
249
				'The link between {circle} and {remote} has been shutdown remotely'
250
			)
251
		);
252
253
		throw new FakeException();
254
	}
255
256
257
	/**
@@ 264-276 (lines=13) @@
261
	 *
262
	 * @throws FakeException
263
	 */
264
	public function parseLinkRemove(IEvent &$event, Circle $circle, FederatedLink $remote) {
265
		if ($event->getSubject() !== 'link_remove') {
266
			return;
267
		}
268
269
		$this->parseCircleEvent(
270
			$event, $circle, $remote,
271
			$this->l10n->t('You closed the link between {circle} and {remote}'),
272
			$this->l10n->t('{author} closed the link between {circle} and {remote}')
273
		);
274
275
		throw new FakeException();
276
	}
277
278
}

lib/Activity/ProviderSubjectMember.php 6 locations

@@ 120-133 (lines=14) @@
117
	 *
118
	 * @throws FakeException
119
	 */
120
	private function parseSubjectMemberAddNotLocalMember(IEvent &$event, Circle $circle, Member $member
121
	) {
122
		if ($member->getType() === Member::TYPE_USER) {
123
			return;
124
		}
125
126
		$this->parseCircleMemberEvent(
127
			$event, $circle, $member,
128
			$this->l10n->t('You added {external} to {circle}'),
129
			$this->l10n->t('{external} has been added to {circle} by {author}')
130
		);
131
132
		throw new FakeException();
133
	}
134
135
136
	/**
@@ 260-274 (lines=15) @@
257
	 *
258
	 * @throws FakeException
259
	 */
260
	private function parseSubjectMemberRemoveNotLocalMember(
261
		IEvent &$event, Circle $circle, Member $member
262
	) {
263
		if ($member->getType() === Member::TYPE_USER) {
264
			return;
265
		}
266
267
		$this->parseCircleMemberEvent(
268
			$event, $circle, $member,
269
			$this->l10n->t('You removed {external} from {circle}'),
270
			$this->l10n->t('{external} has been removed from {circle} by {author}')
271
		);
272
273
		throw new FakeException();
274
	}
275
276
277
	/**
@@ 308-323 (lines=16) @@
305
	}
306
307
308
	private function parseSubjectMemberRemoveNotYetMemberRequesting(
309
		IEvent &$event, Circle $circle, Member $member
310
	) {
311
		if ($member->getStatus() !== Member::STATUS_REQUEST) {
312
			return;
313
		}
314
315
		$this->parseCircleMemberAdvancedEvent(
316
			$event, $circle, $member,
317
			$this->l10n->t("You dismissed {member}'s request to join {circle}"),
318
			$this->l10n->t('Your request to join {circle} has been dismissed by {author}'),
319
			$this->l10n->t("{member}'s request to join {circle} has been dismissed by {author}")
320
		);
321
322
		throw new FakeException();
323
	}
324
325
326
	/**
@@ 333-346 (lines=14) @@
330
	 *
331
	 * @throws FakeException
332
	 */
333
	public function parseMemberInvited(IEvent &$event, Circle $circle, Member $member) {
334
		if ($event->getSubject() !== 'member_invited') {
335
			return;
336
		}
337
338
		$this->parseCircleMemberAdvancedEvent(
339
			$event, $circle, $member,
340
			$this->l10n->t('You invited {member} to join {circle}'),
341
			$this->l10n->t('You have been invited to join {circle} by {author}'),
342
			$this->l10n->t('{member} has been invited to join {circle} by {author}')
343
		);
344
345
		throw new FakeException();
346
	}
347
348
349
	/**
@@ 380-392 (lines=13) @@
377
	 *
378
	 * @throws FakeException
379
	 */
380
	public function parseMemberRequestInvitation(IEvent &$event, Circle $circle, Member $member) {
381
		if ($event->getSubject() !== 'member_request_invitation') {
382
			return;
383
		}
384
385
		$this->parseMemberEvent(
386
			$event, $circle, $member,
387
			$this->l10n->t('You sent a request to join {circle}'),
388
			$this->l10n->t('{member} sent a request to join {circle}')
389
		);
390
391
		throw new FakeException();
392
	}
393
394
395
	/**
@@ 402-413 (lines=12) @@
399
	 *
400
	 * @throws FakeException
401
	 */
402
	public function parseMemberOwner(IEvent &$event, Circle $circle, Member $member) {
403
		if ($event->getSubject() !== 'member_owner') {
404
			return;
405
		}
406
407
		$this->parseMemberEvent(
408
			$event, $circle, $member,
409
			$this->l10n->t('You are the new owner of {circle}'),
410
			$this->l10n->t('{member} is the new owner of {circle}')
411
		);
412
		throw new FakeException();
413
	}
414
}