FakeEntityPagesFetcher   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A fetchEntityPages() 0 11 3
1
<?php
2
3
namespace Tests\Queryr\Replicator\Fixtures;
4
5
use Queryr\Replicator\EntitySource\EntityPageBatchFetcher;
6
use Queryr\Replicator\Model\EntityPage;
7
8
class FakeEntityPagesFetcher implements EntityPageBatchFetcher {
9
10
	private $pages;
11
12
	public function __construct( array $pages = [] ) {
13
		$this->pages = $pages;
14
	}
15
16
	/**
17
	 * @param string[] $entityIds
18
	 * @return EntityPage[]
19
	 */
20
	public function fetchEntityPages( array $entityIds ): array {
21
		$pages = [];
22
23
		foreach ( $entityIds as $entityId ) {
24
			if ( array_key_exists( $entityId, $this->pages ) ) {
25
				$pages[] = $this->pages[$entityId];
26
			}
27
		}
28
29
		return $pages;
30
	}
31
32
}