Passed
Push — master ( 6ccc61...dae1f0 )
by Stephen
02:40
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/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.
src/Bot.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -38,32 +38,32 @@
 block discarded – undo
38 38
     }
39 39
 
40 40
     /**
41
-      * Bot icon image URL 36x36px
42
-      *
43
-      * @return string URL of the 36x36px bot icon image
44
-      */
45
-     public function getIconImage36()
46
-     {
47
-         return $this->data['icons']['image_36'];
48
-     }
41
+     * Bot icon image URL 36x36px
42
+     *
43
+     * @return string URL of the 36x36px bot icon image
44
+     */
45
+        public function getIconImage36()
46
+        {
47
+            return $this->data['icons']['image_36'];
48
+        }
49 49
 
50
-     /**
51
-      * Bot icon image URL 48x48px
52
-      *
53
-      * @return string URL of the 48x48px bot icon image
54
-      */
55
-     public function getIconImage48()
56
-     {
57
-         return $this->data['icons']['image_48'];
58
-     }
50
+        /**
51
+         * Bot icon image URL 48x48px
52
+         *
53
+         * @return string URL of the 48x48px bot icon image
54
+         */
55
+        public function getIconImage48()
56
+        {
57
+            return $this->data['icons']['image_48'];
58
+        }
59 59
 
60
-     /**
61
-      * Bot icon image URL 72x72px
62
-      *
63
-      * @return string URL of the 72x72px bot icon image
64
-      */
65
-     public function getIconImage72()
66
-     {
67
-         return $this->data['icons']['image_72'];
68
-     }
60
+        /**
61
+         * Bot icon image URL 72x72px
62
+         *
63
+         * @return string URL of the 72x72px bot icon image
64
+         */
65
+        public function getIconImage72()
66
+        {
67
+            return $this->data['icons']['image_72'];
68
+        }
69 69
 }
Please login to merge, or discard this patch.
src/ApiClient.php 1 patch
Spacing   +20 added lines, -20 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);
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public function getDMById($id)
240 240
     {
241
-        return $this->getDMs()->then(function (array $dms) use ($id) {
241
+        return $this->getDMs()->then(function(array $dms) use ($id) {
242 242
             foreach ($dms as $dm) {
243 243
                 if ($dm->getId() === $id) {
244 244
                     return $dm;
245 245
                 }
246 246
             }
247 247
 
248
-            throw new ApiException('DM ' . $id . ' not found.');
248
+            throw new ApiException('DM '.$id.' not found.');
249 249
         });
250 250
     }
251 251
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     {
273 273
         return $this->apiCall('im.open', [
274 274
             'user' => $id,
275
-        ])->then(function (Payload $response) {
275
+        ])->then(function(Payload $response) {
276 276
             return $this->getDMById($response['channel']['id']);
277 277
         });
278 278
     }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     public function getUsers()
286 286
     {
287 287
         // get the user list
288
-        return $this->apiCall('users.list')->then(function (Payload $response) {
288
+        return $this->apiCall('users.list')->then(function(Payload $response) {
289 289
             $users = [];
290 290
             foreach ($response['members'] as $member) {
291 291
                 $users[] = new User($this, $member);
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     {
306 306
         return $this->apiCall('users.info', [
307 307
             'user' => $id,
308
-        ])->then(function (Payload $response) {
308
+        ])->then(function(Payload $response) {
309 309
             return new User($this, $response['user']);
310 310
         });
311 311
     }
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      */
321 321
     public function getUserByName($username)
322 322
     {
323
-        return $this->getUsers()->then(function (array $users) use ($username) {
323
+        return $this->getUsers()->then(function(array $users) use ($username) {
324 324
             foreach ($users as $user) {
325 325
                 if ($user->getUsername() === $username) {
326 326
                     return $user;
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     public function apiCall($method, array $args = [])
383 383
     {
384 384
         // create the request url
385
-        $requestUrl = self::BASE_URL . $method;
385
+        $requestUrl = self::BASE_URL.$method;
386 386
 
387 387
         // set the api token
388 388
         $args['token'] = $this->token;
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
         ]);
394 394
 
395 395
         // Add requests to the event loop to be handled at a later date.
396
-        $this->loop->futureTick(function () use ($promise) {
396
+        $this->loop->futureTick(function() use ($promise) {
397 397
             $promise->wait();
398 398
         });
399 399
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
         // promises, so the only Guzzle promises ever used die in here and it is
403 403
         // React from here on out.
404 404
         $deferred = new Deferred();
405
-        $promise->then(function (ResponseInterface $response) use ($deferred) {
405
+        $promise->then(function(ResponseInterface $response) use ($deferred) {
406 406
             // get the response as a json object
407 407
             $payload = Payload::fromJson((string) $response->getBody());
408 408
 
Please login to merge, or discard this patch.