Passed
Pull Request — master (#21)
by
unknown
15:46
created
src/RealTimeClient.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@
 block discarded – undo
252 252
     /**
253 253
      * Handles incoming websocket messages, parses them, and emits them as remote events.
254 254
      *
255
-     * @param WebSocketMessageInterface $messageRaw A websocket message.
255
+     * @param WebSocketMessageInterface $message A websocket message.
256 256
      */
257 257
     private function onMessage(WebSocketMessageInterface $message)
258 258
     {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $this->apiCall('rtm.start')
74 74
 
75 75
         // then connect to the socket...
76
-        ->then(function (Payload $response) {
76
+        ->then(function(Payload $response) {
77 77
             $responseData = $response->getData();
78 78
             // get the team info
79 79
             $this->team = new Team($this, $responseData['team']);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
             // initiate the websocket connection
106 106
             $this->websocket = new WebSocket($responseData['url'], $this->loop, $logger);
107
-            $this->websocket->on('message', function ($message) {
107
+            $this->websocket->on('message', function($message) {
108 108
                 $this->onMessage($message);
109 109
             });
110 110
 
@@ -112,18 +112,18 @@  discard block
 block discarded – undo
112 112
         }, function($exception) use ($deferred) {
113 113
             // if connection was not succesfull
114 114
             $deferred->reject(new ConnectionException(
115
-                'Could not connect to Slack API: '. $exception->getMessage(),
115
+                'Could not connect to Slack API: '.$exception->getMessage(),
116 116
                 $exception->getCode()
117 117
             ));
118 118
         })
119 119
 
120 120
         // then wait for the connection to be ready.
121
-        ->then(function () use ($deferred) {
122
-            $this->once('hello', function () use ($deferred) {
121
+        ->then(function() use ($deferred) {
122
+            $this->once('hello', function() use ($deferred) {
123 123
                 $deferred->resolve();
124 124
             });
125 125
 
126
-            $this->once('error', function ($data) use ($deferred) {
126
+            $this->once('error', function($data) use ($deferred) {
127 127
                 $deferred->reject(new ConnectionException(
128 128
                     'Could not connect to WebSocket: '.$data['error']['msg'],
129 129
                     $data['error']['code']));
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
                     break;
276 276
 
277 277
                 case 'channel_created':
278
-                    $this->getChannelById($payload['channel']['id'])->then(function (Channel $channel) {
278
+                    $this->getChannelById($payload['channel']['id'])->then(function(Channel $channel) {
279 279
                         $this->channels[$channel->getId()] = $channel;
280 280
                     });
281 281
                     break;
Please login to merge, or discard this patch.
src/ApiClient.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function getAuthedUser()
74 74
     {
75
-        return $this->apiCall('auth.test')->then(function (Payload $response) {
75
+        return $this->apiCall('auth.test')->then(function(Payload $response) {
76 76
             return $this->getUserById($response['user_id']);
77 77
         });
78 78
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function getTeam()
86 86
     {
87
-        return $this->apiCall('team.info')->then(function (Payload $response) {
87
+        return $this->apiCall('team.info')->then(function(Payload $response) {
88 88
             return new Team($this, $response['team']);
89 89
         });
90 90
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function getChannels()
118 118
     {
119
-        return $this->apiCall('channels.list')->then(function ($response) {
119
+        return $this->apiCall('channels.list')->then(function($response) {
120 120
             $channels = [];
121 121
             foreach ($response['channels'] as $channel) {
122 122
                 $channels[] = new Channel($this, $channel);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     {
137 137
         return $this->apiCall('channels.info', [
138 138
             'channel' => $id,
139
-        ])->then(function (Payload $response) {
139
+        ])->then(function(Payload $response) {
140 140
             return new Channel($this, $response['channel']);
141 141
         });
142 142
     }
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function getChannelByName($name)
152 152
     {
153
-        return $this->getChannels()->then(function (array $channels) use ($name) {
153
+        return $this->getChannels()->then(function(array $channels) use ($name) {
154 154
             foreach ($channels as $channel) {
155 155
                 if ($channel->getName() === $name) {
156 156
                     return $channel;
157 157
                 }
158 158
             }
159 159
 
160
-            throw new ApiException('Channel ' . $name . ' not found.');
160
+            throw new ApiException('Channel '.$name.' not found.');
161 161
         });
162 162
     }
163 163
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public function getGroups()
170 170
     {
171
-        return $this->apiCall('groups.list')->then(function ($response) {
171
+        return $this->apiCall('groups.list')->then(function($response) {
172 172
             $groups = [];
173 173
             foreach ($response['groups'] as $group) {
174 174
                 $groups[] = new Group($this, $group);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     {
189 189
         return $this->apiCall('groups.info', [
190 190
             'channel' => $id,
191
-        ])->then(function (Payload $response) {
191
+        ])->then(function(Payload $response) {
192 192
             return new Group($this, $response['group']);
193 193
         });
194 194
     }
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function getGroupByName($name)
204 204
     {
205
-        return $this->getGroups()->then(function (array $groups) use ($name) {
205
+        return $this->getGroups()->then(function(array $groups) use ($name) {
206 206
             foreach ($groups as $group) {
207 207
                 if ($group->getName() === $name) {
208 208
                     return $group;
209 209
                 }
210 210
             }
211 211
 
212
-            throw new ApiException('Group ' . $name . ' not found.');
212
+            throw new ApiException('Group '.$name.' not found.');
213 213
         });
214 214
     }
215 215
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      */
221 221
     public function getDMs()
222 222
     {
223
-        return $this->apiCall('im.list')->then(function ($response) {
223
+        return $this->apiCall('im.list')->then(function($response) {
224 224
             $dms = [];
225 225
             foreach ($response['ims'] as $dm) {
226 226
                 $dms[] = new DirectMessageChannel($this, $dm);
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     {
241 241
         return $this->apiCall('im.info', [
242 242
             'channel' => $id,
243
-        ])->then(function (Payload $response) {
243
+        ])->then(function(Payload $response) {
244 244
             return new DirectMessageChannel($this, $response['im']);
245 245
         });
246 246
     }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     {
269 269
         return $this->apiCall('im.open', [
270 270
             'user' => $id,
271
-        ])->then(function (Payload $response) {
271
+        ])->then(function(Payload $response) {
272 272
             return $this->getDMById($response['channel']['id']);
273 273
         });
274 274
     }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     public function getUsers()
282 282
     {
283 283
         // get the user list
284
-        return $this->apiCall('users.list')->then(function (Payload $response) {
284
+        return $this->apiCall('users.list')->then(function(Payload $response) {
285 285
             $users = [];
286 286
             foreach ($response['members'] as $member) {
287 287
                 $users[] = new User($this, $member);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     {
302 302
         return $this->apiCall('users.info', [
303 303
             'user' => $id,
304
-        ])->then(function (Payload $response) {
304
+        ])->then(function(Payload $response) {
305 305
             return new User($this, $response['user']);
306 306
         });
307 307
     }
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      */
317 317
     public function getUserByName($username)
318 318
     {
319
-        return $this->getUsers()->then(function (array $users) use ($username) {
319
+        return $this->getUsers()->then(function(array $users) use ($username) {
320 320
             foreach ($users as $user) {
321 321
                 if ($user->getUsername() === $username) {
322 322
                     return $user;
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
     public function apiCall($method, array $args = [])
379 379
     {
380 380
         // create the request url
381
-        $requestUrl = self::BASE_URL . $method;
381
+        $requestUrl = self::BASE_URL.$method;
382 382
 
383 383
         // set the api token
384 384
         $args['token'] = $this->token;
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         ]);
390 390
 
391 391
         // Add requests to the event loop to be handled at a later date.
392
-        $this->loop->futureTick(function () use ($promise) {
392
+        $this->loop->futureTick(function() use ($promise) {
393 393
             $promise->wait();
394 394
         });
395 395
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         // promises, so the only Guzzle promises ever used die in here and it is
399 399
         // React from here on out.
400 400
         $deferred = new Deferred();
401
-        $promise->then(function (ResponseInterface $response) use ($deferred) {
401
+        $promise->then(function(ResponseInterface $response) use ($deferred) {
402 402
             // get the response as a json object
403 403
             $payload = Payload::fromJson((string) $response->getBody());
404 404
 
Please login to merge, or discard this patch.
src/Channel.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         return $this->client->apiCall('channels.rename', [
117 117
             'channel' => $this->getId(),
118 118
             'name' => $name,
119
-        ])->then(function () use ($name) {
119
+        ])->then(function() use ($name) {
120 120
             $this->data['name'] = $name;
121 121
             return $name;
122 122
         });
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         return $this->client->apiCall('channels.setPurpose', [
135 135
             'channel' => $this->getId(),
136 136
             'purpose' => $text,
137
-        ])->then(function () use ($text) {
137
+        ])->then(function() use ($text) {
138 138
             $this->data['purpose']['value'] = $text;
139 139
             return $text;
140 140
         });
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         return $this->client->apiCall('channels.setTopic', [
153 153
             'channel' => $this->getId(),
154 154
             'topic' => $text,
155
-        ])->then(function () use ($text) {
155
+        ])->then(function() use ($text) {
156 156
             $this->data['topic']['value'] = $text;
157 157
             return $text;
158 158
         });
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     {
168 168
         return $this->client->apiCall('channels.archive', [
169 169
             'channel' => $this->getId(),
170
-        ])->then(function () {
170
+        ])->then(function() {
171 171
             $this->data['is_archived'] = true;
172 172
         });
173 173
     }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         return $this->client->apiCall('channels.unarchive', [
183 183
             'channel' => $this->getId(),
184
-        ])->then(function () {
184
+        ])->then(function() {
185 185
             $this->data['is_archived'] = false;
186 186
         });
187 187
     }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         return $this->client->apiCall('channels.invite', [
199 199
             'channel' => $this->getId(),
200 200
             'user' => $user->getId(),
201
-        ])->then(function () use ($user) {
201
+        ])->then(function() use ($user) {
202 202
             $this->data['members'][] = $user->getId();
203 203
         });
204 204
     }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         return $this->client->apiCall('channels.kick', [
216 216
             'channel' => $this->getId(),
217 217
             'user' => $user->getId(),
218
-        ])->then(function () use ($user) {
218
+        ])->then(function() use ($user) {
219 219
             unset($this->data['members'][$user->getId()]);
220 220
         });
221 221
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         return $this->client->apiCall('channels.close', [
229 229
             'channel' => $this->getId(),
230
-        ])->then(function ($response) {
230
+        ])->then(function($response) {
231 231
             return !isset($response['no_op']);
232 232
         });
233 233
     }
Please login to merge, or discard this patch.
src/DirectMessageChannel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
     {
44 44
         return $this->client->apiCall('im.close', [
45 45
             'channel' => $this->getId(),
46
-        ])->then(function ($response) {
46
+        ])->then(function($response) {
47 47
             return !isset($response['no_op']);
48 48
         });
49 49
     }
Please login to merge, or discard this patch.
src/Group.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         return $this->client->apiCall('groups.rename', [
19 19
             'channel' => $this->getId(),
20 20
             'name' => $name,
21
-        ])->then(function () use ($name) {
21
+        ])->then(function() use ($name) {
22 22
             $this->data['name'] = $name;
23 23
             return $name;
24 24
         });
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         return $this->client->apiCall('groups.setPurpose', [
37 37
             'channel' => $this->getId(),
38 38
             'purpose' => $text,
39
-        ])->then(function () use ($text) {
39
+        ])->then(function() use ($text) {
40 40
             $this->data['purpose']['value'] = $text;
41 41
             return $text;
42 42
         });
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         return $this->client->apiCall('groups.setTopic', [
55 55
             'channel' => $this->getId(),
56 56
             'topic' => $text,
57
-        ])->then(function () use ($text) {
57
+        ])->then(function() use ($text) {
58 58
             $this->data['topic']['value'] = $text;
59 59
             return $text;
60 60
         });
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         return $this->client->apiCall('groups.archive', [
71 71
             'channel' => $this->getId(),
72
-        ])->then(function () {
72
+        ])->then(function() {
73 73
             $this->data['is_archived'] = true;
74 74
         });
75 75
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     {
84 84
         return $this->client->apiCall('groups.unarchive', [
85 85
             'channel' => $this->getId(),
86
-        ])->then(function () {
86
+        ])->then(function() {
87 87
             $this->data['is_archived'] = false;
88 88
         });
89 89
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         return $this->client->apiCall('groups.invite', [
101 101
             'channel' => $this->getId(),
102 102
             'user' => $user->getId(),
103
-        ])->then(function () use ($user) {
103
+        ])->then(function() use ($user) {
104 104
             $this->data['members'][] = $user->getId();
105 105
         });
106 106
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         return $this->client->apiCall('groups.kick', [
118 118
             'channel' => $this->getId(),
119 119
             'user' => $user->getId(),
120
-        ])->then(function () use ($user) {
120
+        ])->then(function() use ($user) {
121 121
             unset($this->data['members'][$user->getId()]);
122 122
         });
123 123
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         return $this->client->apiCall('groups.open', [
133 133
             'channel' => $this->getId(),
134
-        ])->then(function ($response) {
134
+        ])->then(function($response) {
135 135
             return !isset($response['no_op']);
136 136
         });
137 137
     }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         return $this->client->apiCall('groups.close', [
145 145
             'channel' => $this->getId(),
146
-        ])->then(function ($response) {
146
+        ])->then(function($response) {
147 147
             return !isset($response['no_op']);
148 148
         });
149 149
     }
Please login to merge, or discard this patch.
src/Message/AttachmentField.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,6 +51,6 @@
 block discarded – undo
51 51
      */
52 52
     public function isShort()
53 53
     {
54
-        return isset($this->data['short']) && (bool)$this->data['short'];
54
+        return isset($this->data['short']) && (bool) $this->data['short'];
55 55
     }
56 56
 }
Please login to merge, or discard this patch.
src/Payload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public static function fromJson($json)
22 22
     {
23
-        $data = json_decode((string)$json, true);
23
+        $data = json_decode((string) $json, true);
24 24
 
25 25
         if (json_last_error() !== JSON_ERROR_NONE || !is_array($data)) {
26 26
             throw new \UnexpectedValueException('Invalid JSON message.');
Please login to merge, or discard this patch.
src/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
     {
138 138
         return $this->client->apiCall('users.getPresence', [
139 139
             'user' => $this->getId(),
140
-        ])->then(function (Payload $response) {
140
+        ])->then(function(Payload $response) {
141 141
             return $response['presence'];
142 142
         });
143 143
     }
Please login to merge, or discard this patch.