1 | <?php |
||
35 | class Grouping implements ParameterBuilder |
||
36 | { |
||
37 | |||
38 | /** |
||
39 | * @var boolean |
||
40 | */ |
||
41 | protected $isEnabled = false; |
||
42 | |||
43 | /** |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $fields = []; |
||
47 | |||
48 | /** |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $sortings = []; |
||
52 | |||
53 | /** |
||
54 | * @var array |
||
55 | */ |
||
56 | protected $queries = []; |
||
57 | |||
58 | /** |
||
59 | * @var int |
||
60 | */ |
||
61 | protected $numberOfGroups = 5; |
||
62 | |||
63 | /** |
||
64 | * @var int |
||
65 | */ |
||
66 | protected $resultsPerGroup = 1; |
||
67 | |||
68 | /** |
||
69 | * Grouping constructor. |
||
70 | * |
||
71 | * private constructor should only be created with the from* methods |
||
72 | * |
||
73 | * @param bool $isEnabled |
||
74 | * @param array $fields |
||
75 | * @param array $sortings |
||
76 | * @param array $queries |
||
77 | * @param int $numberOfGroups |
||
78 | * @param int $resultsPerGroup |
||
79 | */ |
||
80 | private function __construct($isEnabled, array $fields = [], array $sortings = [], array $queries = [], $numberOfGroups = 5, $resultsPerGroup = 1) |
||
89 | |||
90 | /** |
||
91 | * @return array |
||
92 | */ |
||
93 | public function build() |
||
121 | |||
122 | /** |
||
123 | * @return boolean |
||
124 | */ |
||
125 | public function getIsEnabled() |
||
129 | |||
130 | /** |
||
131 | * @param boolean $isEnabled |
||
132 | */ |
||
133 | public function setIsEnabled($isEnabled) |
||
137 | |||
138 | /** |
||
139 | * @return array |
||
140 | */ |
||
141 | public function getFields() |
||
145 | |||
146 | /** |
||
147 | * @param array $fields |
||
148 | */ |
||
149 | public function setFields(array $fields) |
||
153 | |||
154 | /** |
||
155 | * @param string $field |
||
156 | */ |
||
157 | public function addField(string $field) |
||
161 | |||
162 | /** |
||
163 | * @return array |
||
164 | */ |
||
165 | public function getSortings() |
||
169 | |||
170 | /** |
||
171 | * @param string $sorting |
||
172 | */ |
||
173 | public function addSorting($sorting) |
||
177 | |||
178 | /** |
||
179 | * @param array $sortings |
||
180 | */ |
||
181 | public function setSortings(array $sortings) |
||
185 | |||
186 | /** |
||
187 | * @return array |
||
188 | */ |
||
189 | public function getQueries(): array |
||
193 | |||
194 | /** |
||
195 | * @param string $query |
||
196 | */ |
||
197 | public function addQuery($query) |
||
201 | |||
202 | /** |
||
203 | * @param array $queries |
||
204 | */ |
||
205 | public function setQueries(array $queries) |
||
209 | |||
210 | /** |
||
211 | * @return int |
||
212 | */ |
||
213 | public function getNumberOfGroups() |
||
217 | |||
218 | /** |
||
219 | * @param int $numberOfGroups |
||
220 | */ |
||
221 | public function setNumberOfGroups($numberOfGroups) |
||
225 | |||
226 | /** |
||
227 | * @return int |
||
228 | */ |
||
229 | public function getResultsPerGroup() |
||
233 | |||
234 | /** |
||
235 | * @param int $resultsPerGroup |
||
236 | */ |
||
237 | public function setResultsPerGroup($resultsPerGroup) |
||
242 | |||
243 | /** |
||
244 | * @param TypoScriptConfiguration $solrConfiguration |
||
245 | * @return Grouping |
||
246 | */ |
||
247 | public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration) |
||
275 | } |