Passed
Push — feature/initial-implementation ( fae671...591f29 )
by Fike
02:37
created

Indexing   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 122
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 12
dl 0
loc 122
c 0
b 0
f 0
rs 10

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getOptions() 0 3 1
A getWriteIndices() 0 3 1
A getReadIndices() 0 3 1
A __construct() 0 3 1
A setOptions() 0 4 1
A setAnalysis() 0 4 1
A setType() 0 4 1
A setReadIndices() 0 4 1
A setOption() 0 4 1
A setWriteIndices() 0 4 1
A getType() 0 3 1
A getAnalysis() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AmaTeam\ElasticSearch\API;
6
7
use AmaTeam\ElasticSearch\API\Indexing\Analysis;
8
use AmaTeam\ElasticSearch\API\Indexing\AnalysisInterface;
9
10
class Indexing implements IndexingInterface
11
{
12
    /**
13
     * @var string[]
14
     */
15
    private $readIndices = [];
16
    /**
17
     * @var string[]
18
     */
19
    private $writeIndices = [];
20
    /**
21
     * @var string
22
     */
23
    private $type;
24
    /**
25
     * @var array
26
     */
27
    private $options = [];
28
    /**
29
     * @var AnalysisInterface
30
     */
31
    private $analysis;
32
33
    public function __construct()
34
    {
35
        $this->analysis = new Analysis();
36
    }
37
38
    /**
39
     * @return string[]
40
     */
41
    public function getReadIndices(): array
42
    {
43
        return $this->readIndices;
44
    }
45
46
    /**
47
     * @param string[] $readIndices
48
     * @return $this
49
     */
50
    public function setReadIndices(array $readIndices)
51
    {
52
        $this->readIndices = $readIndices;
53
        return $this;
54
    }
55
56
    /**
57
     * @return string[]
58
     */
59
    public function getWriteIndices(): array
60
    {
61
        return $this->writeIndices;
62
    }
63
64
    /**
65
     * @param string[] $writeIndices
66
     * @return $this
67
     */
68
    public function setWriteIndices(array $writeIndices)
69
    {
70
        $this->writeIndices = $writeIndices;
71
        return $this;
72
    }
73
74
    /**
75
     * @return string
76
     */
77
    public function getType(): string
78
    {
79
        return $this->type;
80
    }
81
82
    /**
83
     * @param string $type
84
     * @return $this
85
     */
86
    public function setType(string $type)
87
    {
88
        $this->type = $type;
89
        return $this;
90
    }
91
92
    /**
93
     * @return array
94
     */
95
    public function getOptions(): array
96
    {
97
        return $this->options;
98
    }
99
100
    /**
101
     * @param array $options
102
     * @return $this
103
     */
104
    public function setOptions(array $options)
105
    {
106
        $this->options = $options;
107
        return $this;
108
    }
109
110
    public function setOption(string $name, $value): Indexing
111
    {
112
        $this->options[$name] = $value;
113
        return $this;
114
    }
115
116
    /**
117
     * @return AnalysisInterface
118
     */
119
    public function getAnalysis(): AnalysisInterface
120
    {
121
        return $this->analysis;
122
    }
123
124
    /**
125
     * @param AnalysisInterface $analysis
126
     * @return $this
127
     */
128
    public function setAnalysis(AnalysisInterface $analysis): Indexing
129
    {
130
        $this->analysis = $analysis;
131
        return $this;
132
    }
133
}
134