Completed
Pull Request — master (#1343)
by Dmitry
05:26
created

IndexConfig::getSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the FOSElasticaBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://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
/**
13
 * This file is part of the FOSElasticaBundle project.
14
 *
15
 * (c) Tim Nagel <[email protected]>
16
 *
17
 * For the full copyright and license information, please view the LICENSE
18
 * file that was distributed with this source code.
19
 */
20
21
namespace FOS\ElasticaBundle\Configuration;
22
23
class IndexConfig extends IndexConfigAbstract
24
{
25
    /**
26
     * Indicates if the index should use an alias, allowing an index repopulation to occur
27
     * without overwriting the current index.
28
     *
29
     * @var bool
30
     */
31
    private $useAlias = false;
32
33
    /**
34
     * Constructor expects an array as generated by the Container Configuration builder.
35
     *
36
     * @param string       $name
37
     * @param TypeConfig[] $types
38
     * @param array        $config
39
     */
40 View Code Duplication
    public function __construct($name, array $types, array $config)
41
    {
42
        $this->elasticSearchName = isset($config['elasticSearchName']) ? $config['elasticSearchName'] : $name;
43
        $this->name = $name;
44
        $this->settings = isset($config['settings']) ? $config['settings'] : [];
45
        $this->types = $types;
46
        $this->useAlias = isset($config['useAlias']) ? $config['useAlias'] : false;
47
    }
48
49
    /**
50
     * @return bool
51
     */
52
    public function isUseAlias()
53
    {
54
        return $this->useAlias;
55
    }
56
}
57