Code Duplication    Length = 20-20 lines in 2 locations

src/Api/CachingResultsBuilder.php 1 location

@@ 374-393 (lines=20) @@
371
	 * @return int[]|null array from entity ID serializations to revision ID,
372
	 * or null to indicate that not all revision IDs could be loaded
373
	 */
374
	private function getLatestRevisionIds( array $entityIds ) {
375
		if ( $entityIds === [] ) {
376
			$this->loggingHelper->logEmptyDependencyMetadata();
377
			return [];
378
		}
379
		if ( count( $entityIds ) > $this->maxRevisionIds ) {
380
			// one of those entities will probably be edited soon, so might as well skip caching
381
			$this->loggingHelper->logHugeDependencyMetadata( $entityIds, $this->maxRevisionIds );
382
			return null;
383
		}
384
385
		$latestRevisionIds = $this->wikiPageEntityMetaDataAccessor->loadLatestRevisionIds(
386
			$entityIds,
387
			EntityRevisionLookup::LATEST_FROM_REPLICA
388
		);
389
		if ( $this->hasFalseElements( $latestRevisionIds ) ) {
390
			return null;
391
		}
392
		return $latestRevisionIds;
393
	}
394
395
	/**
396
	 * @param array $array

src/Api/CachingResultsSource.php 1 location

@@ 431-450 (lines=20) @@
428
	 * @return int[]|null array from entity ID serializations to revision ID,
429
	 * or null to indicate that not all revision IDs could be loaded
430
	 */
431
	private function getLatestRevisionIds( array $entityIds ) {
432
		if ( $entityIds === [] ) {
433
			$this->loggingHelper->logEmptyDependencyMetadata();
434
			return [];
435
		}
436
		if ( count( $entityIds ) > $this->maxRevisionIds ) {
437
			// one of those entities will probably be edited soon, so might as well skip caching
438
			$this->loggingHelper->logHugeDependencyMetadata( $entityIds, $this->maxRevisionIds );
439
			return null;
440
		}
441
442
		$latestRevisionIds = $this->wikiPageEntityMetaDataAccessor->loadLatestRevisionIds(
443
			$entityIds,
444
			EntityRevisionLookup::LATEST_FROM_REPLICA
445
		);
446
		if ( $this->hasFalseElements( $latestRevisionIds ) ) {
447
			return null;
448
		}
449
		return $latestRevisionIds;
450
	}
451
452
	/**
453
	 * @param array $array