@@ -39,7 +39,7 @@ |
||
39 | 39 | */ |
40 | 40 | public function handle() |
41 | 41 | { |
42 | - Karma::created(function (Karma $karma) { |
|
42 | + Karma::created(function(Karma $karma) { |
|
43 | 43 | |
44 | 44 | $count = $karma->target->karma->count(); |
45 | 45 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | */ |
78 | 78 | public function handle() |
79 | 79 | { |
80 | - Achieve::created(function (Achieve $achieve) { |
|
80 | + Achieve::created(function(Achieve $achieve) { |
|
81 | 81 | $room = \App::make(Room::class); |
82 | 82 | |
83 | 83 | $room->write( |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | |
60 | 60 | |
61 | 61 | // Sync users |
62 | - $db->transaction(function () use ($container) { |
|
63 | - $this->comment('Start users synchronize at ' . ($start = Carbon::now())); |
|
62 | + $db->transaction(function() use ($container) { |
|
63 | + $this->comment('Start users synchronize at '.($start = Carbon::now())); |
|
64 | 64 | $container->call([$this, 'importUsers']); |
65 | - $this->comment('Ends ' . Carbon::now()->diffForHumans($start)); |
|
65 | + $this->comment('Ends '.Carbon::now()->diffForHumans($start)); |
|
66 | 66 | }); |
67 | 67 | |
68 | 68 | |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | |
71 | 71 | |
72 | 72 | // Sync messages |
73 | - $db->transaction(function () use ($container) { |
|
74 | - $this->comment('Start messages synchronize at ' . ($start = Carbon::now())); |
|
73 | + $db->transaction(function() use ($container) { |
|
74 | + $this->comment('Start messages synchronize at '.($start = Carbon::now())); |
|
75 | 75 | $container->call([$this, 'importMessages']); |
76 | - $this->comment('Ends ' . Carbon::now()->diffForHumans($start)); |
|
76 | + $this->comment('Ends '.Carbon::now()->diffForHumans($start)); |
|
77 | 77 | }); |
78 | 78 | |
79 | 79 | |
@@ -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 | |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | }); |
154 | 154 | |
155 | 155 | $this->info( |
156 | - '#' . $i . ' ' . |
|
157 | - $data['created_at'] . ' ' . |
|
158 | - mb_substr(str_replace("\n", '', $data['text']), 0, 32) . '... ' |
|
156 | + '#'.$i.' '. |
|
157 | + $data['created_at'].' '. |
|
158 | + mb_substr(str_replace("\n", '', $data['text']), 0, 32).'... ' |
|
159 | 159 | |
160 | 160 | ); |
161 | 161 | |
162 | 162 | } catch (\Throwable $e) { |
163 | 163 | |
164 | - $this->error($e->getMessage() . "\n" . $e->getTraceAsString()); |
|
164 | + $this->error($e->getMessage()."\n".$e->getTraceAsString()); |
|
165 | 165 | |
166 | 166 | } |
167 | 167 | } |
@@ -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,8 +192,8 @@ discard block |
||
192 | 192 | { |
193 | 193 | return (new Evacuator($request)) |
194 | 194 | ->retry(Evacuator::INFINITY_RETRIES) |
195 | - ->catch(function (\Throwable $e) { |
|
196 | - $this->error($e->getMessage() . "\n" . '// retry again'); |
|
195 | + ->catch(function(\Throwable $e) { |
|
196 | + $this->error($e->getMessage()."\n".'// retry again'); |
|
197 | 197 | sleep(1); |
198 | 198 | }) |
199 | 199 | ->invoke(); |
@@ -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 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | foreach ($users as $i => $user) { |
223 | 223 | $user = UserMapper::fromGitterObject($user); |
224 | - $this->comment('#' . $i . ' @' . $user->login); |
|
224 | + $this->comment('#'.$i.' @'.$user->login); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | if ($state->isIncrement() || $state->isTimeout() || $state->isSelf()) { |
244 | - echo "\r" . '[' . $message->created_at . '] ' . |
|
245 | - $state->getTranslation($user->karma_text) . "\n"; |
|
244 | + echo "\r".'['.$message->created_at.'] '. |
|
245 | + $state->getTranslation($user->karma_text)."\n"; |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | */ |
85 | 85 | protected function makePidFile() |
86 | 86 | { |
87 | - $this->pid = storage_path('pids/' . date('Y_m_d_tis_') . microtime(1) . '.pid'); |
|
87 | + $this->pid = storage_path('pids/'.date('Y_m_d_tis_').microtime(1).'.pid'); |
|
88 | 88 | file_put_contents($this->pid, getmypid()); |
89 | 89 | } |
90 | 90 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $this->stop(); |
78 | 78 | break; |
79 | 79 | default: |
80 | - throw new \InvalidArgumentException('Action ' . $action . ' not found'); |
|
80 | + throw new \InvalidArgumentException('Action '.$action.' not found'); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | protected function start() |
88 | 88 | { |
89 | 89 | foreach ($this->config->get('gitter.rooms') as $key => $id) { |
90 | - shell_exec('nohup php artisan gitter:listen ' . $key . ' > /dev/null 2>&1 &'); |
|
90 | + shell_exec('nohup php artisan gitter:listen '.$key.' > /dev/null 2>&1 &'); |
|
91 | 91 | |
92 | - $this->line('Starting ' . $key . ' => ' . $id . ' listener.'); |
|
92 | + $this->line('Starting '.$key.' => '.$id.' listener.'); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | foreach ($finder as $file) { |
107 | 107 | $pid = file_get_contents($file->getRealpath()); |
108 | - shell_exec('kill ' . $pid); |
|
108 | + shell_exec('kill '.$pid); |
|
109 | 109 | unlink($file->getRealpath()); |
110 | 110 | } |
111 | 111 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | } else { |
53 | - $this->answer($message, $message->text_without_special_chars . '?'); |
|
53 | + $this->answer($message, $message->text_without_special_chars.'?'); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -71,6 +71,6 @@ discard block |
||
71 | 71 | protected function answer(Message $message, $text) |
72 | 72 | { |
73 | 73 | $this->lastAnswer = $text; |
74 | - $message->italic(sprintf('@%s, ' . $text, $this->user->login)); |
|
74 | + $message->italic(sprintf('@%s, '.$text, $this->user->login)); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | \ No newline at end of file |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | public static function make($token, $roomId) |
42 | 42 | { |
43 | 43 | $client = new Client($token); |
44 | - App::singleton(Client::class, function () use ($client) { |
|
44 | + App::singleton(Client::class, function() use ($client) { |
|
45 | 45 | return $client; |
46 | 46 | }); |
47 | 47 | App::alias(Client::class, 'gitter'); |
48 | 48 | |
49 | 49 | |
50 | 50 | $room = new Room($roomId); |
51 | - App::singleton(Room::class, function () use ($room) { |
|
51 | + App::singleton(Room::class, function() use ($room) { |
|
52 | 52 | return $room; |
53 | 53 | }); |
54 | 54 | App::alias(Room::class, 'room'); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | return [ |
141 | 141 | 'Content-Type' => 'application/json', |
142 | 142 | 'Accept' => 'application/json', |
143 | - 'Authorization' => 'Bearer ' . $this->token, |
|
143 | + 'Authorization' => 'Bearer '.$this->token, |
|
144 | 144 | ]; |
145 | 145 | } |
146 | 146 |
@@ -92,7 +92,7 @@ |
||
92 | 92 | // TODO Add support for non-latin domains |
93 | 93 | // Current RFC 1738 |
94 | 94 | $pattern = static::getPattern(); |
95 | - preg_match_all($pattern, $text . ' ', $matches, PREG_PATTERN_ORDER); |
|
95 | + preg_match_all($pattern, $text.' ', $matches, PREG_PATTERN_ORDER); |
|
96 | 96 | |
97 | 97 | return $matches[1]; |
98 | 98 | } |
@@ -92,7 +92,7 @@ |
||
92 | 92 | { |
93 | 93 | $karma = $this->karma->count(); |
94 | 94 | |
95 | - return ($karma > 0 ? '+' : '') . $karma; |
|
95 | + return ($karma > 0 ? '+' : '').$karma; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |