Code Duplication    Length = 16-18 lines in 2 locations

includes/deferred/LinksUpdate.php 2 locations

@@ 413-430 (lines=18) @@
410
	 * @param array $existing
411
	 * @return array
412
	 */
413
	private function getLinkInsertions( $existing = [] ) {
414
		$arr = [];
415
		foreach ( $this->mLinks as $ns => $dbkeys ) {
416
			$diffs = isset( $existing[$ns] )
417
				? array_diff_key( $dbkeys, $existing[$ns] )
418
				: $dbkeys;
419
			foreach ( $diffs as $dbk => $id ) {
420
				$arr[] = [
421
					'pl_from' => $this->mId,
422
					'pl_from_namespace' => $this->mTitle->getNamespace(),
423
					'pl_namespace' => $ns,
424
					'pl_title' => $dbk
425
				];
426
			}
427
		}
428
429
		return $arr;
430
	}
431
432
	/**
433
	 * Get an array of template insertions. Like getLinkInsertions()
@@ 437-452 (lines=16) @@
434
	 * @param array $existing
435
	 * @return array
436
	 */
437
	private function getTemplateInsertions( $existing = [] ) {
438
		$arr = [];
439
		foreach ( $this->mTemplates as $ns => $dbkeys ) {
440
			$diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
441
			foreach ( $diffs as $dbk => $id ) {
442
				$arr[] = [
443
					'tl_from' => $this->mId,
444
					'tl_from_namespace' => $this->mTitle->getNamespace(),
445
					'tl_namespace' => $ns,
446
					'tl_title' => $dbk
447
				];
448
			}
449
		}
450
451
		return $arr;
452
	}
453
454
	/**
455
	 * Get an array of image insertions