| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function handle(Message $message, \Closure $next) |
||
| 22 | { |
||
| 23 | $matches = $message->text->escape()->matches('(?:select|insert).*?'); |
||
| 24 | |||
| 25 | if ($matches) { |
||
|
|
|||
| 26 | try { |
||
| 27 | $response = (new BuilderClass((string)$message->text->escape())) |
||
| 28 | ->convert(); |
||
| 29 | |||
| 30 | return (new Response($response))->code('php'); |
||
| 31 | } catch (\Throwable $e) { |
||
| 32 | |||
| 33 | return (new Response('Ошибка при анализе вашего SQL запроса'))->italic(); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | return $next($message); |
||
| 38 | } |
||
| 39 | } |
||
| 41 |
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.