@@ -4,7 +4,6 @@ |
||
4 | 4 | use App\Room; |
5 | 5 | use App\Message; |
6 | 6 | use App\Gitter\Extensions\Middleware\MiddlewareInterface; |
7 | -use Gitter\Client; |
|
8 | 7 | |
9 | 8 | /** |
10 | 9 | * Class GoogleSearchMiddleware |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $client = $this->createClient($container, $config->get('gitter.token')); |
55 | 55 | |
56 | 56 | // Search room |
57 | - $this->findRoom($client, $this->argument('room'), function (GitterRoom $room) { |
|
57 | + $this->findRoom($client, $this->argument('room'), function(GitterRoom $room) { |
|
58 | 58 | try { |
59 | 59 | if ($this->option('users')) { |
60 | 60 | $this->syncUsers($room); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $this->output->write('Fetching...'); |
86 | 86 | |
87 | - $room->getUsers()->fetch(function (GitterUser $gitterUser, Controls $controls) { |
|
87 | + $room->getUsers()->fetch(function(GitterUser $gitterUser, Controls $controls) { |
|
88 | 88 | /** @var User $user */ |
89 | 89 | $user = User::make($gitterUser); |
90 | 90 | |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | |
106 | 106 | $room->getMessages() |
107 | 107 | // Fetch all messages |
108 | - ->fetch(function (GitterMessage $message, Controls $controls) { |
|
108 | + ->fetch(function(GitterMessage $message, Controls $controls) { |
|
109 | 109 | $this->messageRemember($message, $controls); |
110 | 110 | }) |
111 | - ->then(function () use ($room) { |
|
111 | + ->then(function() use ($room) { |
|
112 | 112 | $this->syncLatestMessages($room); |
113 | 113 | }); |
114 | 114 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | if ($lastMessage) { |
142 | 142 | $room->getMessages($lastMessage->gitter_id, GitterRoom::MESSAGE_FETCH_ASC) |
143 | - ->fetch(function (GitterMessage $message, Controls $controls) { |
|
143 | + ->fetch(function(GitterMessage $message, Controls $controls) { |
|
144 | 144 | $this->messageRemember($message, $controls); |
145 | 145 | }); |
146 | 146 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | $this->auth($client, function(User $user) use ($client) { |
59 | 59 | |
60 | - $this->findRoom($client, $this->argument('room'), function (GitterRoom $room) { |
|
60 | + $this->findRoom($client, $this->argument('room'), function(GitterRoom $room) { |
|
61 | 61 | try { |
62 | 62 | $this->getExtensions($room); |
63 | 63 | $this->listen($room, true); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | protected function listen(GitterRoom $gitter, $startup = false) |
99 | 99 | { |
100 | 100 | /** @var Room $room */ |
101 | - $room = Room::make($gitter, function (Room $room) { |
|
101 | + $room = Room::make($gitter, function(Room $room) { |
|
102 | 102 | $this->call('gitter:sync', [ |
103 | 103 | 'room' => $room->gitter_id, |
104 | 104 | '--users' => true, |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | Carbon::now()->toDateTimeString() |
124 | 124 | )); |
125 | 125 | |
126 | - $gitter->onMessage(function (GitterMessage $msg) { |
|
126 | + $gitter->onMessage(function(GitterMessage $msg) { |
|
127 | 127 | $this->onMessage($msg); |
128 | 128 | |
129 | - }, function (\Throwable $e) use ($loop, $gitter) { |
|
129 | + }, function(\Throwable $e) use ($loop, $gitter) { |
|
130 | 130 | $this->error($e->getMessage()); |
131 | 131 | $this->error($e->getFile() . ':' . $e->getLine()); |
132 | 132 | $this->warn('Stream not available. Use message fallback fetch mode.'); |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | ->latest('created_at') |
167 | 167 | ->first(); |
168 | 168 | |
169 | - $loop->addTimer($timeout, function () use ($gitter, $lastMessage) { |
|
169 | + $loop->addTimer($timeout, function() use ($gitter, $lastMessage) { |
|
170 | 170 | $gitter->getMessages($lastMessage->gitter_id, GitterRoom::MESSAGE_FETCH_ASC) |
171 | - ->fetch(function (GitterMessage $message, Controls $controls) { |
|
171 | + ->fetch(function(GitterMessage $message, Controls $controls) { |
|
172 | 172 | $this->onMessage($message); |
173 | 173 | $controls->next(); |
174 | 174 | }) |
175 | - ->then(function () use ($gitter) { |
|
175 | + ->then(function() use ($gitter) { |
|
176 | 176 | $this->warn('Connection...'); |
177 | 177 | $this->listen($gitter); |
178 | 178 | }); |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file is part of GitterBot2 package. |
|
4 | - * |
|
5 | - * @author Serafim <[email protected]> |
|
6 | - * @date 26.01.2016 16:39 |
|
7 | - * |
|
8 | - * For the full copyright and license information, please view the LICENSE |
|
9 | - * file that was distributed with this source code. |
|
10 | - */ |
|
3 | + * This file is part of GitterBot2 package. |
|
4 | + * |
|
5 | + * @author Serafim <[email protected]> |
|
6 | + * @date 26.01.2016 16:39 |
|
7 | + * |
|
8 | + * For the full copyright and license information, please view the LICENSE |
|
9 | + * file that was distributed with this source code. |
|
10 | + */ |
|
11 | 11 | namespace App\Gitter\Extensions; |
12 | 12 | |
13 | 13 | use App\Message; |