Code Duplication    Length = 16-18 lines in 2 locations

includes/deferred/LinksUpdate.php 2 locations

@@ 425-442 (lines=18) @@
422
	 * @param array $existing
423
	 * @return array
424
	 */
425
	private function getLinkInsertions( $existing = [] ) {
426
		$arr = [];
427
		foreach ( $this->mLinks as $ns => $dbkeys ) {
428
			$diffs = isset( $existing[$ns] )
429
				? array_diff_key( $dbkeys, $existing[$ns] )
430
				: $dbkeys;
431
			foreach ( $diffs as $dbk => $id ) {
432
				$arr[] = [
433
					'pl_from' => $this->mId,
434
					'pl_from_namespace' => $this->mTitle->getNamespace(),
435
					'pl_namespace' => $ns,
436
					'pl_title' => $dbk
437
				];
438
			}
439
		}
440
441
		return $arr;
442
	}
443
444
	/**
445
	 * Get an array of template insertions. Like getLinkInsertions()
@@ 449-464 (lines=16) @@
446
	 * @param array $existing
447
	 * @return array
448
	 */
449
	private function getTemplateInsertions( $existing = [] ) {
450
		$arr = [];
451
		foreach ( $this->mTemplates as $ns => $dbkeys ) {
452
			$diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
453
			foreach ( $diffs as $dbk => $id ) {
454
				$arr[] = [
455
					'tl_from' => $this->mId,
456
					'tl_from_namespace' => $this->mTitle->getNamespace(),
457
					'tl_namespace' => $ns,
458
					'tl_title' => $dbk
459
				];
460
			}
461
		}
462
463
		return $arr;
464
	}
465
466
	/**
467
	 * Get an array of image insertions