IndexConfig::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 9
cts 9
cp 1
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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