Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
85.71% covered (warning)
85.71%
6 / 7
85.71% covered (warning)
85.71%
6 / 7
CRAP
0.00% covered (danger)
0.00%
0 / 1
ConstantAssignment
85.71% covered (warning)
85.71%
6 / 7
85.71% covered (warning)
85.71%
6 / 7
7.14
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 uniqueId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getServerList
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSearchCluster
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWritableClusters
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 canWriteToCluster
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getCrossClusterName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace CirrusSearch\Assignment;
4
5class 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    public function uniqueId( $cluster ) {
17        return 'default';
18    }
19
20    /**
21     * @param string|null $cluster
22     * @return string[]|array[]
23     */
24    public function getServerList( $cluster = null ): array {
25        return $this->servers;
26    }
27
28    public function getSearchCluster() {
29        return 'default';
30    }
31
32    public function getWritableClusters(): array {
33        return [ 'default' ];
34    }
35
36    public function canWriteToCluster( $clusterName ) {
37        return true;
38    }
39
40    public function getCrossClusterName() {
41        return null;
42    }
43}