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
|
|
|
|