Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
66.67% covered (warning)
66.67%
6 / 9
66.67% covered (warning)
66.67%
6 / 9
CRAP
0.00% covered (danger)
0.00%
0 / 1
ConstantAssignment
66.67% covered (warning)
66.67%
6 / 9
66.67% covered (warning)
66.67%
6 / 9
12.00
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
 getAllKnownClusters
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 hasCluster
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 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( string $updateGroup ): array {
33        return [ 'default' ];
34    }
35
36    public function getAllKnownClusters(): array {
37        return [ 'default' ];
38    }
39
40    public function hasCluster( string $clusterName ): bool {
41        return true;
42    }
43
44    public function canWriteToCluster( $clusterName, $updateGroup ) {
45        return true;
46    }
47
48    public function getCrossClusterName() {
49        return null;
50    }
51}