Conditions | 4 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public function handle(Message $message) |
||
17 | { |
||
18 | $isImage = preg_match( |
||
19 | '/[^`]http(?:s)?:\/\/.*?\.(?:jpg|png|jpeg|svg|bmp)/iu' |
||
20 | , ' ' . $message->text); |
||
21 | |||
22 | $isVideo = preg_match( |
||
23 | '/[^`]http(?:s)?:\/\/(?:www\.)?(?:youtube\.com|youtu\.be).*?/iu' |
||
24 | , ' ' . $message->text); |
||
25 | |||
26 | if (($isImage || $isVideo) && $message->user->login !== \Auth::user()->login) { |
||
27 | $answer = \Lang::get('gitter.inline', [ |
||
28 | 'user' => $message->user->login |
||
29 | ]); |
||
30 | $message->italic($answer); |
||
31 | } |
||
32 | |||
33 | return $message; |
||
34 | } |
||
35 | } |
||
36 |