Completed
Push — master ( 8b30ba...c06433 )
by Karel
04:39
created

IndexConfig::getElasticSearchName()   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 implements IndexConfigInterface
24
{
25
    use IndexConfigTrait;
26
27
    /**
28
     * Indicates if the index should use an alias, allowing an index repopulation to occur
29
     * without overwriting the current index.
30
     *
31
     * @var bool
32
     */
33
    private $useAlias = false;
34
35
    /**
36
     * Constructor expects an array as generated by the Container Configuration builder.
37
     *
38
     * @param string       $name
39
     * @param TypeConfig[] $types
40
     * @param array        $config
41
     */
42 27
    public function __construct($name, array $types, array $config)
43
    {
44 27
        $this->elasticSearchName = isset($config['elasticSearchName']) ? $config['elasticSearchName'] : $name;
45 27
        $this->name = $name;
46 27
        $this->settings = isset($config['settings']) ? $config['settings'] : [];
47 27
        $this->types = $types;
48 27
        $this->useAlias = isset($config['useAlias']) ? $config['useAlias'] : false;
49 27
    }
50
51
    /**
52
     * @return bool
53
     */
54 13
    public function isUseAlias()
55
    {
56 13
        return $this->useAlias;
57
    }
58
}
59