@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if ($isHello) { |
| 51 | 51 | $id = array_rand(trans('personal.hello')); |
| 52 | 52 | |
| 53 | - $message->italic(trans('personal.hello.' . $id, [ |
|
| 53 | + $message->italic(trans('personal.hello.'.$id, [ |
|
| 54 | 54 | 'user' => $message->user->login |
| 55 | 55 | ])); |
| 56 | 56 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | if ($isBan) { |
| 112 | 112 | $message->italic(sprintf( |
| 113 | - '@%s, тебе выданы ' . str_repeat(' :hammer: ', random_int(1, 9)) . ' на 0.' . random_int(1, 9) . ' секунды. Наслаждайся ;)', |
|
| 113 | + '@%s, тебе выданы '.str_repeat(' :hammer: ', random_int(1, 9)).' на 0.'.random_int(1, 9).' секунды. Наслаждайся ;)', |
|
| 114 | 114 | $message->user->login |
| 115 | 115 | )); |
| 116 | 116 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | if ($isPolitics) { |
| 131 | 131 | $message->italic(sprintf( |
| 132 | - '@%s, за ' . $message->text_without_special_chars . '! ' . str_repeat(' :monkey: ', random_int(1, 9)), |
|
| 132 | + '@%s, за '.$message->text_without_special_chars.'! '.str_repeat(' :monkey: ', random_int(1, 9)), |
|
| 133 | 133 | $message->user->login |
| 134 | 134 | )); |
| 135 | 135 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | public function handle(RoomInterface $room) |
| 80 | 80 | { |
| 81 | - Achieve::created(function (Achieve $achieve) use($room) { |
|
| 81 | + Achieve::created(function(Achieve $achieve) use($room) { |
|
| 82 | 82 | $room->sendMessage( |
| 83 | 83 | trans('achieve.receiving', [ |
| 84 | 84 | 'user' => $achieve->user->login, |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | */ |
| 140 | 140 | public function code($code, $lang = '') |
| 141 | 141 | { |
| 142 | - if (! empty($lang)) { |
|
| 142 | + if (!empty($lang)) { |
|
| 143 | 143 | return $this->answer("[code={$lang}]{$code}[/code]"); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function register() |
| 30 | 30 | { |
| 31 | - $this->app->singleton(Client::class, function (Container $app) { |
|
| 31 | + $this->app->singleton(Client::class, function(Container $app) { |
|
| 32 | 32 | return new Client($app['config']->get('gitter.token')); |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | - $this->app->singleton('bot', function (Container $app) { |
|
| 35 | + $this->app->singleton('bot', function(Container $app) { |
|
| 36 | 36 | /** @var Client $client */ |
| 37 | 37 | $client = $app->make(Client::class); |
| 38 | 38 | return $client->http->getCurrentUser()->wait(); |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function boot() |
| 43 | 43 | { |
| 44 | - $this->app->singleton('bot.manager', function (Container $app) { |
|
| 44 | + $this->app->singleton('bot.manager', function(Container $app) { |
|
| 45 | 45 | return new BotManager($app); |
| 46 | 46 | }); |
| 47 | 47 | |
| 48 | - $this->app->singleton('room.manager', function (Container $app) { |
|
| 48 | + $this->app->singleton('room.manager', function(Container $app) { |
|
| 49 | 49 | $manager = new RoomManager(); |
| 50 | 50 | |
| 51 | 51 | $this->registerGitterRooms($manager); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | protected function registerGitterRooms(RoomManager $manager) |
| 59 | 59 | { |
| 60 | - foreach ((array) $this->app['config']->get('gitter.rooms') as $room => $groups) { |
|
| 60 | + foreach ((array)$this->app['config']->get('gitter.rooms') as $room => $groups) { |
|
| 61 | 61 | $manager->register( |
| 62 | 62 | new StandartGitterRoom($room, $groups, \Config::get('gitter.middlewares')) |
| 63 | 63 | ); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | protected function registerSlackRooms(RoomManager $manager) |
| 68 | 68 | { |
| 69 | - foreach ((array) $this->app['config']->get('slack.rooms') as $roomId => $groups) { |
|
| 69 | + foreach ((array)$this->app['config']->get('slack.rooms') as $roomId => $groups) { |
|
| 70 | 70 | $manager->register( |
| 71 | 71 | new StandartSlackRoom($roomId, $groups, \Config::get('slack.middlewares')) |
| 72 | 72 | ); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | parent::__construct(); |
| 28 | 28 | |
| 29 | 29 | $this->alias = $alias; |
| 30 | - $this->groups = (array) $groups; |
|
| 30 | + $this->groups = (array)$groups; |
|
| 31 | 31 | |
| 32 | 32 | $this->setMiddleware($middleware); |
| 33 | 33 | } |
@@ -58,14 +58,14 @@ |
||
| 58 | 58 | trans('google.personal', [ |
| 59 | 59 | 'user' => $mention->login, |
| 60 | 60 | 'query' => urlencode($query), |
| 61 | - ]) . |
|
| 62 | - PHP_EOL . $search |
|
| 61 | + ]). |
|
| 62 | + PHP_EOL.$search |
|
| 63 | 63 | ); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return $message->answer( |
| 67 | - trans('google.common', ['query' => urlencode($query)]) . |
|
| 68 | - PHP_EOL . $search |
|
| 67 | + trans('google.common', ['query' => urlencode($query)]). |
|
| 68 | + PHP_EOL.$search |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $result = $client->initIndex('docs')->search($query); |
| 33 | 33 | |
| 34 | - if ((int) array_get($result, 'nbHits') === 0) { |
|
| 34 | + if ((int)array_get($result, 'nbHits') === 0) { |
|
| 35 | 35 | $message->text = "погугли {$query}"; |
| 36 | 36 | return app(NewGoogleSearchMiddleware::class)->handle($message); |
| 37 | 37 | } |
@@ -40,25 +40,25 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $hits = new Collection($result['hits']); |
| 42 | 42 | |
| 43 | - $hits->unique(function ($row) { |
|
| 43 | + $hits->unique(function($row) { |
|
| 44 | 44 | return $row['h1']; |
| 45 | - })->map(function ($row) { |
|
| 46 | - $row['link'] = 'https://laravel.com/docs/5.2/' . $row['link']; |
|
| 45 | + })->map(function($row) { |
|
| 46 | + $row['link'] = 'https://laravel.com/docs/5.2/'.$row['link']; |
|
| 47 | 47 | return $row; |
| 48 | - })->take(3)->each(function ($row) use (&$response) { |
|
| 48 | + })->take(3)->each(function($row) use (&$response) { |
|
| 49 | 49 | $title = ''; |
| 50 | 50 | foreach (['h1', 'h2', 'h3', 'h4', 'h5'] as $tag) { |
| 51 | 51 | if (isset($row[$tag])) { |
| 52 | - $title .= ' ' . $row[$tag]; |
|
| 52 | + $title .= ' '.$row[$tag]; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - $response .= "[*] [i][url={$row['link']}]{$title}[/url][/i]" . PHP_EOL; |
|
| 56 | + $response .= "[*] [i][url={$row['link']}]{$title}[/url][/i]".PHP_EOL; |
|
| 57 | 57 | }); |
| 58 | 58 | |
| 59 | 59 | if (!empty($response)) { |
| 60 | 60 | $message->answer(trans('search.results', [ |
| 61 | - 'results' => '[list]' . PHP_EOL . $response . PHP_EOL . '[/list]', |
|
| 61 | + 'results' => '[list]'.PHP_EOL.$response.PHP_EOL.'[/list]', |
|
| 62 | 62 | ])); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -17,13 +17,13 @@ |
||
| 17 | 17 | { |
| 18 | 18 | $isImage = preg_match( |
| 19 | 19 | '/[^`]http(?:s)?:\/\/.*?\.(?:jpg|png|jpeg|svg|bmp)/iu' |
| 20 | - , ' ' . $message->text); |
|
| 20 | + , ' '.$message->text); |
|
| 21 | 21 | |
| 22 | 22 | $isVideo = preg_match( |
| 23 | 23 | '/[^`]http(?:s)?:\/\/(?:www\.)?(?:youtube\.com|youtu\.be).*?/iu' |
| 24 | - , ' ' . $message->text); |
|
| 24 | + , ' '.$message->text); |
|
| 25 | 25 | |
| 26 | - if (($isImage || $isVideo) && ! $message->user->isBot()) { |
|
| 26 | + if (($isImage || $isVideo) && !$message->user->isBot()) { |
|
| 27 | 27 | $answer = trans('gitter.inline', [ |
| 28 | 28 | 'user' => $message->user->login |
| 29 | 29 | ]); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $this->text = preg_replace_callback('%\[user\]([\W\D\w\s]*?)\[/user\]%iu', |
| 44 | 44 | |
| 45 | - function ($matches) { |
|
| 45 | + function($matches) { |
|
| 46 | 46 | $username = trim($matches[1]); |
| 47 | 47 | |
| 48 | 48 | return empty($username) ? "" : "@{$username}"; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $this->text = preg_replace_callback('%\[pre\]([\W\D\w\s]*?)\[/pre\]%iu', |
| 61 | 61 | |
| 62 | - function ($matches) { |
|
| 62 | + function($matches) { |
|
| 63 | 63 | return "`{$matches[1]}`"; |
| 64 | 64 | }, |
| 65 | 65 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $this->text = preg_replace_callback('%\[h([0-6]{1})\]([\W\D\w\s]*?)\[/h[0-6]?\]%iu', |
| 76 | 76 | |
| 77 | - function ($matches) { |
|
| 77 | + function($matches) { |
|
| 78 | 78 | $size = $matches[1]; |
| 79 | 79 | |
| 80 | 80 | return str_repeat('#', $size).' '.$matches[2].PHP_EOL; |