| Conditions | 3 |
| Paths | 3 |
| Total Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function process(Query $inlineQuery): void |
||
| 27 | { |
||
| 28 | if (mb_strlen($inlineQuery->query) < 2) { |
||
| 29 | return; |
||
| 30 | } |
||
| 31 | |||
| 32 | $answerInlineQuery = new AnswerInlineQuery(); |
||
| 33 | $answerInlineQuery->inline_query_id = $inlineQuery->id; |
||
| 34 | |||
| 35 | foreach ($this->userRepo->findUsersLikeLogin($inlineQuery->query) as $user) { |
||
| 36 | $article = new Query\Result\Article(); |
||
| 37 | $article->title = $user->getLogin(); |
||
| 38 | |||
| 39 | $contentText = new Text(); |
||
| 40 | $contentText->message_text = sprintf( |
||
| 41 | "@%s:\nName: %s\nSubscribers: %d", |
||
| 42 | $user->getLogin(), |
||
| 43 | $user->getName(), |
||
| 44 | $user->getSubscribers()->count() |
||
| 45 | ); |
||
| 46 | |||
| 47 | $article->input_message_content = $contentText; |
||
| 48 | $article->id = md5($user->getId()); |
||
| 49 | |||
| 50 | $answerInlineQuery->addResult($article); |
||
| 51 | } |
||
| 52 | |||
| 53 | $this->client->performApiRequest($answerInlineQuery); |
||
| 54 | } |
||
| 55 | } |