IndexConfigurationRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 31
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 8 2
1
<?php
2
3
namespace GBProd\ElasticsearchExtraBundle\Repository;
4
5
/**
6
 * Repository for index configuration
7
 *
8
 * @author gbprod <[email protected]>
9
 */
10
class IndexConfigurationRepository
11
{
12
    /**
13
     * @var array
14
     */
15
    private $config;
16
17
    /**
18
     * @param array $config
19
     */
20
    public function __construct(array $config = array())
21
    {
22 1
        $this->config = $config;
23 1
    }
24
25
    /**
26
     * Get client from his name
27
     *
28
     * @param string $index
29
     *
30
     * @return Elasticsearch\Client
31
     */
32
    public function get($index)
33
    {
34 1
        if (!isset($this->config[$index])) {
35 1
            return null;
36
        }
37
38 1
        return $this->config[$index];
39
    }
40
}
41