Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
66.67% |
6 / 9 |
|
66.67% |
6 / 9 |
CRAP | |
0.00% |
0 / 1 |
ConstantAssignment | |
66.67% |
6 / 9 |
|
66.67% |
6 / 9 |
12.00 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
uniqueId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getServerList | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getSearchCluster | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getWritableClusters | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getAllKnownClusters | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
hasCluster | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
canWriteToCluster | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCrossClusterName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace CirrusSearch\Assignment; |
4 | |
5 | class ConstantAssignment implements ClusterAssignment { |
6 | /** @var string[]|array[] Elastica connection configuration */ |
7 | private $servers; |
8 | |
9 | /** |
10 | * @param string[]|array[] $servers Elastica connection configuration |
11 | */ |
12 | public function __construct( array $servers ) { |
13 | $this->servers = $servers; |
14 | } |
15 | |
16 | /** @inheritDoc */ |
17 | public function uniqueId( $cluster ) { |
18 | return 'default'; |
19 | } |
20 | |
21 | /** |
22 | * @param string|null $cluster |
23 | * @return string[]|array[] |
24 | */ |
25 | public function getServerList( $cluster = null ): array { |
26 | return $this->servers; |
27 | } |
28 | |
29 | /** @inheritDoc */ |
30 | public function getSearchCluster() { |
31 | return 'default'; |
32 | } |
33 | |
34 | /** @inheritDoc */ |
35 | public function getWritableClusters( string $updateGroup ): array { |
36 | return [ 'default' ]; |
37 | } |
38 | |
39 | /** @inheritDoc */ |
40 | public function getAllKnownClusters(): array { |
41 | return [ 'default' ]; |
42 | } |
43 | |
44 | /** @inheritDoc */ |
45 | public function hasCluster( string $clusterName ): bool { |
46 | return true; |
47 | } |
48 | |
49 | /** @inheritDoc */ |
50 | public function canWriteToCluster( $clusterName, $updateGroup ) { |
51 | return true; |
52 | } |
53 | |
54 | /** @inheritDoc */ |
55 | public function getCrossClusterName() { |
56 | return null; |
57 | } |
58 | } |