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

Context   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 111
Duplicated Lines 0 %

Importance

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

10 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldValidate() 0 3 1
A setPreservedIndexingOptions() 0 4 1
A setIgnoreUnknownEntries() 0 4 1
A setNormalize() 0 4 1
A shouldNormalize() 0 3 1
A getPreservedIndexingOptions() 0 3 1
A setPreservedMappingParameters() 0 4 1
A shouldPreserveUnknownEntries() 0 3 1
A setValidate() 0 4 1
A getPreservedMappingParameters() 0 3 1
1
<?php
2
3
namespace AmaTeam\ElasticSearch\API\Entity\Loader;
4
5
class Context implements ContextInterface
6
{
7
    /**
8
     * @var bool
9
     */
10
    private $validate = true;
11
    /**
12
     * @var bool
13
     */
14
    private $normalize = true;
15
    /**
16
     * @var bool
17
     */
18
    private $ignoreUnknownEntries = false;
19
    /**
20
     * @var string[]
21
     */
22
    private $preservedMappingParameters = [];
23
    /**
24
     * @var string[]
25
     */
26
    private $preservedIndexingOptions = [];
27
28
    /**
29
     * @return bool
30
     */
31
    public function shouldValidate(): bool
32
    {
33
        return $this->validate;
34
    }
35
36
    /**
37
     * @param bool $validate
38
     * @return $this
39
     */
40
    public function setValidate(bool $validate): Context
41
    {
42
        $this->validate = $validate;
43
        return $this;
44
    }
45
46
    /**
47
     * @return bool
48
     */
49
    public function shouldPreserveUnknownEntries(): bool
50
    {
51
        return $this->ignoreUnknownEntries;
52
    }
53
54
    /**
55
     * @param bool $ignoreUnknownEntries
56
     * @return $this
57
     */
58
    public function setIgnoreUnknownEntries(bool $ignoreUnknownEntries): Context
59
    {
60
        $this->ignoreUnknownEntries = $ignoreUnknownEntries;
61
        return $this;
62
    }
63
64
    /**
65
     * @return bool
66
     */
67
    public function shouldNormalize(): bool
68
    {
69
        return $this->normalize;
70
    }
71
72
    /**
73
     * @param bool $normalize
74
     * @return $this
75
     */
76
    public function setNormalize(bool $normalize): Context
77
    {
78
        $this->normalize = $normalize;
79
        return $this;
80
    }
81
82
    /**
83
     * @return string[]
84
     */
85
    public function getPreservedMappingParameters(): array
86
    {
87
        return $this->preservedMappingParameters;
88
    }
89
90
    /**
91
     * @param string[] $preservedMappingParameters
92
     * @return $this
93
     */
94
    public function setPreservedMappingParameters(array $preservedMappingParameters): Context
95
    {
96
        $this->preservedMappingParameters = $preservedMappingParameters;
97
        return $this;
98
    }
99
100
    /**
101
     * @return string[]
102
     */
103
    public function getPreservedIndexingOptions(): array
104
    {
105
        return $this->preservedIndexingOptions;
106
    }
107
108
    /**
109
     * @param string[] $preservedIndexingOptions
110
     * @return $this
111
     */
112
    public function setPreservedIndexingOptions(array $preservedIndexingOptions): Context
113
    {
114
        $this->preservedIndexingOptions = $preservedIndexingOptions;
115
        return $this;
116
    }
117
}
118