Code Duplication    Length = 23-24 lines in 2 locations

includes/specials/SpecialContributions.php 1 location

@@ 276-299 (lines=24) @@
273
			// and also this will display a totally irrelevant log entry as a current block.
274
			if ( !$this->including() ) {
275
				$block = Block::newFromTarget( $userObj, $userObj );
276
				if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
277
					if ( $block->getType() == Block::TYPE_RANGE ) {
278
						$nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget();
279
					}
280
281
					$out = $this->getOutput(); // showLogExtract() wants first parameter by reference
282
					LogEventsList::showLogExtract(
283
						$out,
284
						'block',
285
						$nt,
286
						'',
287
						[
288
							'lim' => 1,
289
							'showIfEmpty' => false,
290
							'msgKey' => [
291
								$userObj->isAnon() ?
292
									'sp-contributions-blocked-notice-anon' :
293
									'sp-contributions-blocked-notice',
294
								$userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
295
							],
296
							'offset' => '' # don't use WebRequest parameter offset
297
						]
298
					);
299
				}
300
			}
301
		}
302

includes/specials/SpecialDeletedContributions.php 1 location

@@ 228-250 (lines=23) @@
225
226
			// Show a note if the user is blocked and display the last block log entry.
227
			$block = Block::newFromTarget( $userObj, $userObj );
228
			if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
229
				if ( $block->getType() == Block::TYPE_RANGE ) {
230
					$nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget();
231
				}
232
233
				// LogEventsList::showLogExtract() wants the first parameter by ref
234
				$out = $this->getOutput();
235
				LogEventsList::showLogExtract(
236
					$out,
237
					'block',
238
					$nt,
239
					'',
240
					[
241
						'lim' => 1,
242
						'showIfEmpty' => false,
243
						'msgKey' => [
244
							'sp-contributions-blocked-notice',
245
							$userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
246
						],
247
						'offset' => '' # don't use $this->getRequest() parameter offset
248
					]
249
				);
250
			}
251
		}
252
253
		return $this->msg( 'contribsub2' )->rawParams( $user, $links )->params( $userObj->getName() );