| Conditions | 5 |
| Paths | 6 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public function handle(Message $message, \Closure $next) |
||
| 35 | { |
||
| 36 | $matches = $message->text->escape()->matches('(@.*?\s)?(?:погугли|гугли)\s(.*?)'); |
||
| 37 | |||
| 38 | if ($matches) { |
||
|
|
|||
| 39 | if (!trim($matches[2])) { |
||
| 40 | return $next($message); |
||
| 41 | } |
||
| 42 | |||
| 43 | $mention = $this->getUserLogin($message); |
||
| 44 | |||
| 45 | return trim($matches[1]) && $mention |
||
| 46 | ? trans('google.personal', [ |
||
| 47 | 'user' => $mention->login, |
||
| 48 | 'query' => urlencode($matches[2]), |
||
| 49 | ]) |
||
| 50 | : trans('google.common', [ |
||
| 51 | 'query' => urlencode($matches[2]), |
||
| 52 | ]); |
||
| 53 | } |
||
| 54 | |||
| 55 | return $next($message); |
||
| 56 | } |
||
| 57 | |||
| 78 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.