Code Duplication    Length = 23-24 lines in 2 locations

includes/specials/SpecialContributions.php 1 location

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

includes/specials/SpecialDeletedContributions.php 1 location

@@ 160-182 (lines=23) @@
157
158
			// Show a note if the user is blocked and display the last block log entry.
159
			$block = Block::newFromTarget( $userObj, $userObj );
160
			if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
161
				if ( $block->getType() == Block::TYPE_RANGE ) {
162
					$nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget();
163
				}
164
165
				// LogEventsList::showLogExtract() wants the first parameter by ref
166
				$out = $this->getOutput();
167
				LogEventsList::showLogExtract(
168
					$out,
169
					'block',
170
					$nt,
171
					'',
172
					[
173
						'lim' => 1,
174
						'showIfEmpty' => false,
175
						'msgKey' => [
176
							'sp-contributions-blocked-notice',
177
							$userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
178
						],
179
						'offset' => '' # don't use $this->getRequest() parameter offset
180
					]
181
				);
182
			}
183
		}
184
185
		return $this->msg( 'contribsub2' )->rawParams( $user, $links )->params( $userObj->getName() );