@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | { |
104 | 104 | $parts = explode(':', $notification['message']); |
105 | 105 | $refId = (int) trim($parts[1]); |
106 | - $result = $this->queryGerrit('change:' . $refId); |
|
107 | - $msg = '*Hi <@' . $user . '>, <@' . $notification['from_user'] . '>' |
|
106 | + $result = $this->queryGerrit('change:'.$refId); |
|
107 | + $msg = '*Hi <@'.$user.'>, <@'.$notification['from_user'].'>' |
|
108 | 108 | . ' ask you to look at this patch:*'; |
109 | 109 | |
110 | 110 | if (is_array($result)) { |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | { |
127 | 127 | $parts = explode(':', $notification['message']); |
128 | 128 | $issueNumber = (int) trim($parts[1]); |
129 | - $result = $this->queryForge('issues/' . $issueNumber); |
|
129 | + $result = $this->queryForge('issues/'.$issueNumber); |
|
130 | 130 | if ($result) { |
131 | - $msg = '*Hi <@' . $user . '>, <@' . $notification['from_user'] . '>' |
|
131 | + $msg = '*Hi <@'.$user.'>, <@'.$notification['from_user'].'>' |
|
132 | 132 | . ' ask you to look at this issue:*'; |
133 | - $this->sendResponse($msg . "\n" . $this->buildIssueMessage($result->issue), $user); |
|
133 | + $this->sendResponse($msg."\n".$this->buildIssueMessage($result->issue), $user); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | */ |
141 | 141 | protected function processTextMessage(array $notification, string $user) |
142 | 142 | { |
143 | - $msg = '*Hi <@' . $user . '>, here is a message from <@' . $notification['from_user'] . '>' . ' for you:*'; |
|
144 | - $this->sendResponse($msg . chr(10) . $notification['message'], $user); |
|
143 | + $msg = '*Hi <@'.$user.'>, here is a message from <@'.$notification['from_user'].'>'.' for you:*'; |
|
144 | + $this->sendResponse($msg.chr(10).$notification['message'], $user); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -167,6 +167,6 @@ discard block |
||
167 | 167 | 'message' => $message, |
168 | 168 | ]); |
169 | 169 | |
170 | - return 'OK, I will tell <@' . $toUser . '> about your message'; |
|
170 | + return 'OK, I will tell <@'.$toUser.'> about your message'; |
|
171 | 171 | } |
172 | 172 | } |
@@ -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 | } |
@@ -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); |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | $patchId = (int) str_replace('https://review.typo3.org/', '', $json->{'change-url'}); |
41 | 41 | $patchSet = property_exists($json, 'patchset') ? (int) $json->patchset : 0; |
42 | 42 | |
43 | - $item = $this->queryGerrit('change:' . $patchId); |
|
43 | + $item = $this->queryGerrit('change:'.$patchId); |
|
44 | 44 | $item = $item[0]; |
45 | 45 | $created = substr($item->created, 0, 19); |
46 | 46 | $text = "Branch: {$json->branch} | :calendar: {$created} | ID: {$item->_number}\n"; |
47 | 47 | $text .= ":link: <https://review.typo3.org/{$item->_number}|Goto Review>"; |
48 | 48 | if ($hook === 'patchset-created' && $patchSet === 1 && $json->branch === 'master') { |
49 | - $message = $this->buildMessage('[NEW] ' . $item->subject, $text); |
|
49 | + $message = $this->buildMessage('[NEW] '.$item->subject, $text); |
|
50 | 50 | $this->sendMessageToChannel($hook, $message); |
51 | 51 | } elseif ($hook === 'change-merged') { |
52 | - $message = $this->buildMessage(':white_check_mark: [MERGED] ' . $item->subject, $text, Message\Attachment::COLOR_GOOD); |
|
52 | + $message = $this->buildMessage(':white_check_mark: [MERGED] '.$item->subject, $text, Message\Attachment::COLOR_GOOD); |
|
53 | 53 | $this->sendMessageToChannel($hook, $message); |
54 | 54 | $this->checkFiles($patchId, $json->commit); |
55 | 55 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $attachment->setColor($color[$status]); |
114 | 114 | $attachment->setTitle($text[$status]); |
115 | 115 | |
116 | - $text = ':link: <https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/' . $fileName . '|' . $fileName . '>'; |
|
116 | + $text = ':link: <https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/'.$fileName.'|'.$fileName.'>'; |
|
117 | 117 | $attachment->setText($text); |
118 | 118 | $attachment->setFallback($text); |
119 | 119 | $message->addAttachment($attachment); |