@@ -72,7 +72,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |