| Conditions | 4 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function search(): ?string |
||
| 30 | { |
||
| 31 | $query = App::$Security->strip_tags($this->request->query->get('search'), null); |
||
| 32 | if (!Any::isStr($query) || Str::likeEmpty($query) || Str::length($query) > static::SEARCH_QUERY_MAX_LENGTH) { |
||
| 33 | throw new ForbiddenException(__('Wrong query format')); |
||
| 34 | } |
||
| 35 | |||
| 36 | $model = new CollectionSearchResults($query, 10); |
||
| 37 | App::$Event->run(static::SEARCH_EVENT_NAME, [ |
||
| 38 | 'model' => $model |
||
| 39 | ]); |
||
| 40 | |||
| 41 | return $this->view->render('main/search', [ |
||
| 42 | 'model' => $model |
||
| 43 | ]); |
||
| 45 | } |