@@ -88,7 +88,7 @@ |
||
88 | 88 | |
89 | 89 | /** @var User $mention */ |
90 | 90 | foreach ($message->mentions as $mention) { |
91 | - $question = $this->buffer->last(function ($i, Message $question) use ($mention) { |
|
91 | + $question = $this->buffer->last(function($i, Message $question) use ($mention) { |
|
92 | 92 | if ($question->user) { |
93 | 93 | return $question->user->getId() === $mention->getId(); |
94 | 94 | } |
@@ -30,12 +30,12 @@ |
||
30 | 30 | $config = $this->app->make(Repository::class); |
31 | 31 | |
32 | 32 | |
33 | - $this->app->singleton(Client::class, function (Container $app) use ($config) { |
|
33 | + $this->app->singleton(Client::class, function(Container $app) use ($config) { |
|
34 | 34 | return new Client($config->get('gitter.token')); |
35 | 35 | }); |
36 | 36 | |
37 | 37 | |
38 | - $this->app->singleton('bot', function (Container $app) { |
|
38 | + $this->app->singleton('bot', function(Container $app) { |
|
39 | 39 | /** @var Client $client */ |
40 | 40 | $client = $app->make(Client::class); |
41 | 41 | return $client->http->getCurrentUser()->wait(); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | |
38 | 38 | $user = User::where('gitter_id', $values['gitter_id'])->first(); |
39 | 39 | if (!$user) { |
40 | - $user = User::unguarded(function () use ($values) { |
|
40 | + $user = User::unguarded(function() use ($values) { |
|
41 | 41 | return User::create($values); |
42 | 42 | }); |
43 | 43 | } |
@@ -35,11 +35,11 @@ |
||
35 | 35 | */ |
36 | 36 | public function register() |
37 | 37 | { |
38 | - AnnotationRegistry::registerLoader(function ($class) { |
|
38 | + AnnotationRegistry::registerLoader(function($class) { |
|
39 | 39 | return class_exists($class); |
40 | 40 | }); |
41 | 41 | |
42 | - $this->app->singleton(Reader::class, function (Application $app) { |
|
42 | + $this->app->singleton(Reader::class, function(Application $app) { |
|
43 | 43 | $debug = $app->make(Repository::class)->get('app.debug', false); |
44 | 44 | $cache = $app->make($debug ? ArrayCache::class : CacheBridge::class); |
45 | 45 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | |
61 | 61 | // Sync users |
62 | - $db->transaction(function () use ($container) { |
|
62 | + $db->transaction(function() use ($container) { |
|
63 | 63 | $this->comment('Start users synchronize at ' . ($start = Carbon::now())); |
64 | 64 | $container->call([$this, 'importUsers']); |
65 | 65 | $this->comment('Ends ' . Carbon::now()->diffForHumans($start)); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | |
72 | 72 | // Sync messages |
73 | - $db->transaction(function () use ($container) { |
|
73 | + $db->transaction(function() use ($container) { |
|
74 | 74 | $this->comment('Start messages synchronize at ' . ($start = Carbon::now())); |
75 | 75 | $container->call([$this, 'importMessages']); |
76 | 76 | $this->comment('Ends ' . Carbon::now()->diffForHumans($start)); |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | $rootTimeZone = new \DateTimeZone('UTC'); |
94 | 94 | |
95 | 95 | |
96 | - $messages = new ApiIterator(function ($page) use ($client, $room, $limit, &$lastMessageId) { |
|
96 | + $messages = new ApiIterator(function($page) use ($client, $room, $limit, &$lastMessageId) { |
|
97 | 97 | $query = ['limit' => $limit]; |
98 | 98 | |
99 | 99 | if ($lastMessageId !== null) { |
100 | 100 | $query['beforeId'] = $lastMessageId; |
101 | 101 | } |
102 | 102 | |
103 | - $result = $this->rescue(function () use ($room, $query, $client) { |
|
103 | + $result = $this->rescue(function() use ($room, $query, $client) { |
|
104 | 104 | return $client->http->getMessages($room->id, $query)->wait(); |
105 | 105 | }); |
106 | 106 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | try { |
138 | 138 | |
139 | - $db->transaction(function () use ($message, $data, $db) { |
|
139 | + $db->transaction(function() use ($message, $data, $db) { |
|
140 | 140 | $db->table('messages')->where('gitter_id', $data['gitter_id'])->delete(); |
141 | 141 | $db->table('messages')->insert($data); |
142 | 142 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | private function getRoom(Client $client) |
178 | 178 | { |
179 | - return $this->rescue(function () use ($client) { |
|
179 | + return $this->rescue(function() use ($client) { |
|
180 | 180 | return $client->http->getRoomById($this->argument('room'))->wait(); |
181 | 181 | }); |
182 | 182 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | { |
193 | 193 | return (new Evacuator($request)) |
194 | 194 | ->retry(Evacuator::INFINITY_RETRIES) |
195 | - ->catch(function (\Throwable $e) { |
|
195 | + ->catch(function(\Throwable $e) { |
|
196 | 196 | $this->error($e->getMessage() . "\n" . '// retry again'); |
197 | 197 | sleep(1); |
198 | 198 | }) |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | $room = $this->getRoom($client); |
211 | 211 | |
212 | 212 | |
213 | - $users = new ApiIterator(function ($page) use ($client, $room) { |
|
214 | - return $this->rescue(function () use ($room, $page, $client) { |
|
213 | + $users = new ApiIterator(function($page) use ($client, $room) { |
|
214 | + return $this->rescue(function() use ($room, $page, $client) { |
|
215 | 215 | |
216 | 216 | return $client->http->getRoomUsers($room->id, ['limit' => 30, 'skip' => 30 * $page])->wait(); |
217 | 217 |