| Conditions | 3 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function actionIndex(): ?string |
||
| 22 | { |
||
| 23 | $this->setJsonHeader(); |
||
| 24 | // get search query as string from request |
||
| 25 | $query = $this->request->query->get('query', null); |
||
| 26 | if (Str::likeEmpty($query) || Str::length($query) < 2) { |
||
| 27 | throw new JsonException('Short query'); |
||
| 28 | } |
||
| 29 | |||
| 30 | // initialize basic search model |
||
| 31 | $model = new EntitySearchMain($query, ['itemPerApp' => 3]); |
||
| 32 | $model->make(); |
||
|
|
|||
| 33 | |||
| 34 | // build response by relevance as array |
||
| 35 | $response = $model->getRelevanceSortedResult(); |
||
| 36 | |||
| 37 | return json_encode([ |
||
| 38 | 'status' => 1, |
||
| 39 | 'count' => count($response), |
||
| 40 | 'data' => $response |
||
| 41 | ]); |
||
| 44 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.