@@ 140-157 (lines=18) @@ | ||
137 | * |
|
138 | * @throws InvalidArgument |
|
139 | */ |
|
140 | protected function setFilters($filters) |
|
141 | { |
|
142 | if (empty($filters)) { |
|
143 | return; |
|
144 | } |
|
145 | ||
146 | if (is_string($filters)) { |
|
147 | $filters = $this->parser->parse($filters); |
|
148 | } |
|
149 | ||
150 | if (!is_array($filters)) { |
|
151 | throw new InvalidArgument('Search filter is malformed.'); |
|
152 | } |
|
153 | ||
154 | foreach ($filters as $filter) { |
|
155 | $this->filters[] = $filter instanceof Filter ? $filter : $this->createFilterFromConfig($filter); |
|
156 | } |
|
157 | } |
|
158 | ||
159 | ||
160 | /** |
|
@@ 176-193 (lines=18) @@ | ||
173 | * |
|
174 | * @throws InvalidArgument |
|
175 | */ |
|
176 | protected function setSorts($sorts) |
|
177 | { |
|
178 | if (empty($sorts)) { |
|
179 | return; |
|
180 | } |
|
181 | ||
182 | if (is_string($sorts)) { |
|
183 | $sorts = $this->parser->parse($sorts); |
|
184 | } |
|
185 | ||
186 | if (!is_array($sorts)) { |
|
187 | throw new InvalidArgument('Search sort is malformed.'); |
|
188 | } |
|
189 | ||
190 | foreach ($sorts as $sort) { |
|
191 | $this->sorts[] = $sort instanceof Sort ? $sort : $this->createSortFromConfig($sort); |
|
192 | } |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |