IndexConfig   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A isUseAlias() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the FOSElasticaBundle package.
5
 *
6
 * (c) FriendsOfSymfony <https://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\ElasticaBundle\Configuration;
13
14
class IndexConfig implements IndexConfigInterface
15
{
16
    use IndexConfigTrait;
17
18
    /**
19
     * Indicates if the index should use an alias, allowing an index repopulation to occur
20
     * without overwriting the current index.
21
     *
22
     * @var bool
23
     */
24
    private $useAlias = false;
25
26
    /**
27
     * Constructor expects an array as generated by the Container Configuration builder.
28
     */
29 26
    public function __construct(array $config)
30
    {
31 26
        $this->elasticSearchName = $config['elasticsearch_name'] ?? $config['name'];
32 26
        $this->name = $config['name'];
33 26
        $this->settings = $config['settings'] ?? [];
34 26
        $this->useAlias = $config['use_alias'] ?? false;
35 26
        $this->config = $config['config'];
36 26
        $this->mapping = $config['mapping'];
37 26
        $this->model = $config['model'];
38 26
    }
39
40 9
    public function isUseAlias(): bool
41
    {
42 9
        return $this->useAlias;
43
    }
44
}
45