Completed
Pull Request — 7.0 (#917)
by Toni
01:35
created

IndexSettings::setPropertyMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
/*
3
 * This file is part of the ONGR package.
4
 *
5
 * (c) NFQ Technologies UAB <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace ONGR\ElasticsearchBundle\Mapping;
12
13
class IndexSettings
14
{
15
    private $namespace;
16
    private $indexName;
17
    private $alias;
18
    private $indexMetadata;
19
    private $propertyMetadata;
20
    private $hosts;
21
    private $defaultIndex = false;
22
23
    public function __construct(
24
        string $namespace,
25
        string $indexName,
26
        string $alias,
27
        array $indexMetadata = [],
28
        array $propertyMetadata = [],
29
        array $hosts = [],
30
        bool $defaultIndex = false
31
    ) {
32
        $this->namespace = $namespace;
33
        $this->indexName = $indexName;
34
        $this->alias = $alias;
35
        $this->indexMetadata = $indexMetadata;
36
        $this->propertyMetadata = $propertyMetadata;
37
        $this->hosts = $hosts;
38
        $this->defaultIndex = $defaultIndex;
39
    }
40
41
    public function getNamespace()
42
    {
43
        return $this->namespace;
44
    }
45
46
    public function setNamespace($namespace): void
47
    {
48
        $this->namespace = $namespace;
49
    }
50
51
    public function getIndexName()
52
    {
53
        return $this->indexName;
54
    }
55
56
    public function setIndexName($indexName): void
57
    {
58
        $this->indexName = $indexName;
59
    }
60
61
    public function getAlias()
62
    {
63
        return $this->alias;
64
    }
65
66
    public function setAlias($alias): void
67
    {
68
        $this->alias = $alias;
69
    }
70
71
    public function getIndexMetadata()
72
    {
73
        return $this->indexMetadata;
74
    }
75
76
    public function setIndexMetadata($indexMetadata): void
77
    {
78
        $this->indexMetadata = array_filter(array_merge_recursive(
79
            $this->indexMetadata,
80
            $indexMetadata
81
        ));
82
    }
83
84
    public function getPropertyMetadata(): array
85
    {
86
        return $this->propertyMetadata;
87
    }
88
89
    public function setPropertyMetadata(array $propertyMetadata): void
90
    {
91
        $this->propertyMetadata = $propertyMetadata;
92
    }
93
94
    public function getHosts()
95
    {
96
        return $this->hosts;
97
    }
98
99
    public function setHosts($hosts): void
100
    {
101
        $this->hosts = $hosts;
102
    }
103
104
    public function isDefaultIndex(): bool
105
    {
106
        return $this->defaultIndex;
107
    }
108
109
    public function setDefaultIndex(bool $defaultIndex): void
110
    {
111
        $this->defaultIndex = $defaultIndex;
112
    }
113
}
114