@@ -45,14 +45,14 @@ |
||
45 | 45 | $message = $this->payload->getData()['text']; |
46 | 46 | $parts = explode(':', $message); |
47 | 47 | $command = ucfirst(strtolower($parts[0])); |
48 | - $commandClass = '\\T3Bot\\Commands\\' . $command . 'Command'; |
|
48 | + $commandClass = '\\T3Bot\\Commands\\'.$command.'Command'; |
|
49 | 49 | if (class_exists($commandClass)) { |
50 | 50 | return new $commandClass($this->payload, $this->client, $configuration); |
51 | 51 | } |
52 | 52 | |
53 | 53 | $parts = explode(' ', $message); |
54 | 54 | $command = ucfirst(strtolower($parts[0])); |
55 | - $commandClass = '\\T3Bot\\Commands\\' . $command . 'Command'; |
|
55 | + $commandClass = '\\T3Bot\\Commands\\'.$command.'Command'; |
|
56 | 56 | if (class_exists($commandClass)) { |
57 | 57 | return new $commandClass($this->payload, $this->client, $configuration); |
58 | 58 | } |
@@ -47,26 +47,26 @@ discard block |
||
47 | 47 | switch ($hook) { |
48 | 48 | case 'patchset-created': |
49 | 49 | if ($patchSet === 1 && $branch === 'master') { |
50 | - $item = $this->queryGerrit('change:' . $patchId); |
|
50 | + $item = $this->queryGerrit('change:'.$patchId); |
|
51 | 51 | $item = $item[0]; |
52 | 52 | $created = substr($item->created, 0, 19); |
53 | 53 | |
54 | 54 | $text = "Branch: *{$branch}* | :calendar: _{$created}_ | ID: {$item->_number}\n"; |
55 | 55 | $text .= ":link: <https://review.typo3.org/{$item->_number}|Review now>"; |
56 | 56 | |
57 | - $message = $this->buildMessage('[NEW] ' . $item->subject, $text); |
|
57 | + $message = $this->buildMessage('[NEW] '.$item->subject, $text); |
|
58 | 58 | $this->sendMessageToChannel($hook, $message); |
59 | 59 | } |
60 | 60 | break; |
61 | 61 | case 'change-merged': |
62 | - $item = $this->queryGerrit('change:' . $patchId); |
|
62 | + $item = $this->queryGerrit('change:'.$patchId); |
|
63 | 63 | $item = $item[0]; |
64 | 64 | $created = substr($item->created, 0, 19); |
65 | 65 | |
66 | 66 | $text = "Branch: {$branch} | :calendar: {$created} | ID: {$item->_number}\n"; |
67 | 67 | $text .= ":link: <https://review.typo3.org/{$item->_number}|Goto Review>"; |
68 | 68 | |
69 | - $message = $this->buildMessage(':white_check_mark: [MERGED] ' . $item->subject, $text, Message\Attachment::COLOR_GOOD); |
|
69 | + $message = $this->buildMessage(':white_check_mark: [MERGED] '.$item->subject, $text, Message\Attachment::COLOR_GOOD); |
|
70 | 70 | $this->sendMessageToChannel($hook, $message); |
71 | 71 | |
72 | 72 | $files = $this->getFilesForPatch($patchId, $commit); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $attachment->setTitle('A documentation file has been updated'); |
99 | 99 | break; |
100 | 100 | } |
101 | - $text = ':link: <https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/' . $fileName . '|' . $fileName . '>'; |
|
101 | + $text = ':link: <https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/'.$fileName.'|'.$fileName.'>'; |
|
102 | 102 | $attachment->setText($text); |
103 | 103 | $attachment->setFallback($text); |
104 | 104 | $message->addAttachment($attachment); |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | $client = new Slack\RealTimeClient($loop); |
17 | 17 | $client->setToken($GLOBALS['config']['slack']['botAuthToken']); |
18 | 18 | |
19 | -$client->on('message', function (Slack\Payload $payload) use ($client) { |
|
19 | +$client->on('message', function(Slack\Payload $payload) use ($client) { |
|
20 | 20 | $user = $payload->getData()['user']; |
21 | 21 | $blackList = array_map('trim', explode(',', $GLOBALS['config']['slack']['userBlacklist'])); |
22 | 22 | if (in_array($user, $blackList, true)) { |
23 | 23 | $client->apiCall('im.open', ['user' => $user]) |
24 | - ->then(function (Slack\Payload $response) use ($client) { |
|
24 | + ->then(function(Slack\Payload $response) use ($client) { |
|
25 | 25 | $channel = $response->getData()['channel']['id']; |
26 | 26 | $data = []; |
27 | 27 | $data['unfurl_links'] = false; |
@@ -48,28 +48,28 @@ discard block |
||
48 | 48 | } |
49 | 49 | }); |
50 | 50 | |
51 | -$client->on('channel_created', function (Slack\Payload $payload) use ($client) { |
|
51 | +$client->on('channel_created', function(Slack\Payload $payload) use ($client) { |
|
52 | 52 | if ($payload->getData()['user'] !== $GLOBALS['config']['slack']['botId']) { |
53 | 53 | $command = new \T3Bot\Commands\ChannelCommand($payload, $client, $GLOBALS['config']); |
54 | 54 | $command->processChannelCreated($payload->getData()); |
55 | 55 | } |
56 | 56 | }); |
57 | 57 | |
58 | -$client->on('presence_change', function (Slack\Payload $payload) use ($client) { |
|
58 | +$client->on('presence_change', function(Slack\Payload $payload) use ($client) { |
|
59 | 59 | if ($payload->getData()['user'] !== $GLOBALS['config']['slack']['botId']) { |
60 | 60 | $command = new \T3Bot\Commands\TellCommand($payload, $client, $GLOBALS['config']); |
61 | 61 | $command->processPresenceChange($payload->getData()['user'], $payload->getData()['presence']); |
62 | 62 | } |
63 | 63 | }); |
64 | 64 | |
65 | -$client->connect()->then(function () use ($client) { |
|
65 | +$client->connect()->then(function() use ($client) { |
|
66 | 66 | echo "Connected!\n"; |
67 | 67 | }); |
68 | 68 | |
69 | 69 | /* @noinspection PhpInternalEntityUsedInspection */ |
70 | 70 | $db = \Doctrine\DBAL\DriverManager::getConnection($GLOBALS['config']['db'], new \Doctrine\DBAL\Configuration()); |
71 | 71 | |
72 | -$loop->addPeriodicTimer(5, function () use ($client, $db) { |
|
72 | +$loop->addPeriodicTimer(5, function() use ($client, $db) { |
|
73 | 73 | $messages = $db->fetchAll('SELECT * FROM messages ORDER BY id ASC'); |
74 | 74 | foreach ($messages as $message) { |
75 | 75 | $data = json_decode($message['message'], true); |