@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | protected function bold($string) : string |
| 28 | 28 | { |
| 29 | - return '*' . $string . '*'; |
|
| 29 | + return '*'.$string.'*'; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | protected function italic($string) : string |
| 40 | 40 | { |
| 41 | - return '_' . $string . '_'; |
|
| 41 | + return '_'.$string.'_'; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | protected function buildReviewLine($item) : string |
| 52 | 52 | { |
| 53 | - return $this->bold($item->subject) . ' <https://review.typo3.org/' . $item->_number |
|
| 54 | - . '|Review #' . $item->_number . ' now>'; |
|
| 53 | + return $this->bold($item->subject).' <https://review.typo3.org/'.$item->_number |
|
| 54 | + . '|Review #'.$item->_number.' now>'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -63,15 +63,15 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $created = substr($item->created_on, 0, 19); |
| 65 | 65 | $updated = substr($item->updated_on, 0, 19); |
| 66 | - $text = $this->bold('[' . $item->tracker->name . '] ' . $item->subject) |
|
| 67 | - . ' by ' . $this->italic($item->author->name) . chr(10); |
|
| 68 | - $text .= 'Project: ' . $this->bold($item->project->name); |
|
| 66 | + $text = $this->bold('['.$item->tracker->name.'] '.$item->subject) |
|
| 67 | + . ' by '.$this->italic($item->author->name).chr(10); |
|
| 68 | + $text .= 'Project: '.$this->bold($item->project->name); |
|
| 69 | 69 | if (!empty($item->category->name)) { |
| 70 | - $text .= ' | Category: ' . $this->bold($item->category->name); |
|
| 70 | + $text .= ' | Category: '.$this->bold($item->category->name); |
|
| 71 | 71 | } |
| 72 | - $text .= ' | Status: ' . $this->bold($item->status->name) . chr(10); |
|
| 73 | - $text .= ':calendar: Created: ' . $this->bold($created) . ' | Last update: ' . $this->bold($updated) . chr(10); |
|
| 74 | - $text .= '<https://forge.typo3.org/issues/' . $item->id . '|:arrow_right: View on Forge>'; |
|
| 72 | + $text .= ' | Status: '.$this->bold($item->status->name).chr(10); |
|
| 73 | + $text .= ':calendar: Created: '.$this->bold($created).' | Last update: '.$this->bold($updated).chr(10); |
|
| 74 | + $text .= '<https://forge.typo3.org/issues/'.$item->id.'|:arrow_right: View on Forge>'; |
|
| 75 | 75 | |
| 76 | 76 | return $text; |
| 77 | 77 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | protected function queryGerrit($query) |
| 20 | 20 | { |
| 21 | - return $this->remoteCall('https://review.typo3.org/changes/?q=' . urlencode($query)); |
|
| 21 | + return $this->remoteCall('https://review.typo3.org/changes/?q='.urlencode($query)); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | protected function getFilesForPatch($changeId, $revision) |
| 31 | 31 | { |
| 32 | 32 | return $this->remoteCall( |
| 33 | - 'https://review.typo3.org/changes/' . $changeId . '/revisions/' . $revision . '/files' |
|
| 33 | + 'https://review.typo3.org/changes/'.$changeId.'/revisions/'.$revision.'/files' |
|
| 34 | 34 | ); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $result = false; |
| 52 | 52 | if (!curl_errno($ch)) { |
| 53 | 53 | curl_close($ch); |
| 54 | - $result = json_decode(str_replace(")]}'" . chr(10), '', $data)); |
|
| 54 | + $result = json_decode(str_replace(")]}'".chr(10), '', $data)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return $result; |
@@ -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 | - $text = "Branch: {$json->branch} | :calendar: {$created} | ID: {$item->_number}" . chr(10); |
|
| 46 | + $text = "Branch: {$json->branch} | :calendar: {$created} | ID: {$item->_number}".chr(10); |
|
| 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 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $attachment->setColor($color[$status]); |
| 129 | 129 | $attachment->setTitle($text[$status]); |
| 130 | 130 | |
| 131 | - $text = ':link: <https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/' . $fileName . '|' . $fileName . '>'; |
|
| 131 | + $text = ':link: <https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/'.$fileName.'|'.$fileName.'>'; |
|
| 132 | 132 | $attachment->setText($text); |
| 133 | 133 | $attachment->setFallback($text); |
| 134 | 134 | return $attachment; |
@@ -64,6 +64,6 @@ |
||
| 64 | 64 | { |
| 65 | 65 | $delimiter = strpos($message, ':') !== false ? ':' : ' '; |
| 66 | 66 | $parts = explode($delimiter, $message); |
| 67 | - return '\\T3Bot\\Commands\\' . ucfirst(strtolower($parts[0])) . 'Command'; |
|
| 67 | + return '\\T3Bot\\Commands\\'.ucfirst(strtolower($parts[0])).'Command'; |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | $countMinus2 = count($result); |
| 60 | 60 | |
| 61 | 61 | $returnString = ''; |
| 62 | - $returnString .= 'There are currently ' . $this->bold($count) . ' open reviews for project ' |
|
| 63 | - . $this->italic($project) . ' and branch master on <https://review.typo3.org/#/q/project:' . $project |
|
| 64 | - . '+status:open+branch:master|https://review.typo3.org>' . chr(10); |
|
| 65 | - $returnString .= $this->bold($countMinus1) . ' of ' . $this->bold($count) . ' open reviews voted with ' |
|
| 66 | - . $this->bold('-1') . ' <https://review.typo3.org/#/q/label:Code-Review%253D-1+is:open+branch:' |
|
| 67 | - . 'master+project:' . $project . '|Check now> ' . chr(10); |
|
| 68 | - $returnString .= $this->bold($countMinus2) . ' of ' . $this->bold($count) . ' open reviews voted with ' |
|
| 69 | - . $this->bold('-2') . ' <https://review.typo3.org/#/q/label:Code-Review%253D-2+is:open+branch:' |
|
| 70 | - . 'master+project:' . $project . '|Check now>'; |
|
| 62 | + $returnString .= 'There are currently '.$this->bold($count).' open reviews for project ' |
|
| 63 | + . $this->italic($project).' and branch master on <https://review.typo3.org/#/q/project:'.$project |
|
| 64 | + . '+status:open+branch:master|https://review.typo3.org>'.chr(10); |
|
| 65 | + $returnString .= $this->bold($countMinus1).' of '.$this->bold($count).' open reviews voted with ' |
|
| 66 | + . $this->bold('-1').' <https://review.typo3.org/#/q/label:Code-Review%253D-1+is:open+branch:' |
|
| 67 | + . 'master+project:'.$project.'|Check now> '.chr(10); |
|
| 68 | + $returnString .= $this->bold($countMinus2).' of '.$this->bold($count).' open reviews voted with ' |
|
| 69 | + . $this->bold('-2').' <https://review.typo3.org/#/q/label:Code-Review%253D-2+is:open+branch:' |
|
| 70 | + . 'master+project:'.$project.'|Check now>'; |
|
| 71 | 71 | |
| 72 | 72 | return $returnString; |
| 73 | 73 | } |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | if ($username === null) { |
| 99 | 99 | return 'hey, I need a username!'; |
| 100 | 100 | } |
| 101 | - $results = $this->queryGerrit('is:open owner:"' . $username . '" project:' . $project); |
|
| 101 | + $results = $this->queryGerrit('is:open owner:"'.$username.'" project:'.$project); |
|
| 102 | 102 | if (count($results) > 0) { |
| 103 | - $listOfItems = ['*Here are the results for ' . $username . '*:']; |
|
| 103 | + $listOfItems = ['*Here are the results for '.$username.'*:']; |
|
| 104 | 104 | if (is_array($results)) { |
| 105 | 105 | foreach ($results as $item) { |
| 106 | 106 | $listOfItems[] = $this->buildReviewLine($item); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | return implode(chr(10), $listOfItems); |
| 111 | 111 | } |
| 112 | - return $username . ' has no open reviews or username is unknown'; |
|
| 112 | + return $username.' has no open reviews or username is unknown'; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $paramsCount = count($this->params); |
| 148 | 148 | $changeIds = []; |
| 149 | 149 | for ($i = 1; $i < $paramsCount; ++$i) { |
| 150 | - $changeIds[] = 'change:' . $this->params[$i]; |
|
| 150 | + $changeIds[] = 'change:'.$this->params[$i]; |
|
| 151 | 151 | } |
| 152 | 152 | $result = $this->queryGerrit(implode(' OR ', $changeIds)); |
| 153 | 153 | $listOfItems = []; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | protected function buildReviewMessageOutput(int $refId) |
| 168 | 168 | { |
| 169 | - $result = $this->queryGerrit('change:' . $refId); |
|
| 169 | + $result = $this->queryGerrit('change:'.$refId); |
|
| 170 | 170 | if (!empty($result)) { |
| 171 | 171 | foreach ($result as $item) { |
| 172 | 172 | if ($item->_number === $refId) { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | return 'hey, I need a query!'; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - $results = $this->queryGerrit('limit:50 ' . $query); |
|
| 193 | + $results = $this->queryGerrit('limit:50 '.$query); |
|
| 194 | 194 | if (!empty($results)) { |
| 195 | 195 | $listOfItems = ["*Here are the results for {$query}*:"]; |
| 196 | 196 | foreach ($results as $item) { |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | $cnt = count($result); |
| 220 | 220 | |
| 221 | - return 'Good job folks, since ' . $date . ' you merged *' . $cnt . '* patches into master'; |
|
| 221 | + return 'Good job folks, since '.$date.' you merged *'.$cnt.'* patches into master'; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | protected function processAll() : string |
| 51 | 51 | { |
| 52 | - return 'Yeah, ' . $this->getBeerCountAll() . ' :t3beer: spend to all people'; |
|
| 52 | + return 'Yeah, '.$this->getBeerCountAll().' :t3beer: spend to all people'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $rows = $this->getBeerTop10(); |
| 65 | 65 | $text = ['*Yeah, here are the TOP 10*']; |
| 66 | 66 | foreach ($rows as $row) { |
| 67 | - $text[] = '<@' . $row['username'] . '> has received ' . $row['cnt'] . ' :t3beer:'; |
|
| 67 | + $text[] = '<@'.$row['username'].'> has received '.$row['cnt'].' :t3beer:'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return implode(chr(10), $text); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | if (strpos($username, '<') === 0 && $username[1] === '@') { |
| 86 | 86 | $username = str_replace(['<', '>', '@'], '', $username); |
| 87 | 87 | |
| 88 | - return '<@' . $username . '> has received ' . $this->getBeerCountByUsername($username) . ' :t3beer: so far'; |
|
| 88 | + return '<@'.$username.'> has received '.$this->getBeerCountByUsername($username).' :t3beer: so far'; |
|
| 89 | 89 | } |
| 90 | 90 | return '*Sorry, a username must start with a @-sign:*'; |
| 91 | 91 | } |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | 'from_user' => $from_user, |
| 110 | 110 | 'tstamp' => time() |
| 111 | 111 | ]); |
| 112 | - return 'Yeah, one more :t3beer: for <@' . $username . '>' . chr(10) . '<@' . $username . '> has received ' |
|
| 113 | - . $this->getBeerCountByUsername($username) . ' :t3beer: so far'; |
|
| 112 | + return 'Yeah, one more :t3beer: for <@'.$username.'>'.chr(10).'<@'.$username.'> has received ' |
|
| 113 | + . $this->getBeerCountByUsername($username).' :t3beer: so far'; |
|
| 114 | 114 | } |
| 115 | - return 'You spend one :t3beer: to <@' . $username . '> within in last 24 hours. Too much beer is unhealthy ;)'; |
|
| 115 | + return 'You spend one :t3beer: to <@'.$username.'> within in last 24 hours. Too much beer is unhealthy ;)'; |
|
| 116 | 116 | } |
| 117 | 117 | return '*Sorry, a username must start with a @-sign:*'; |
| 118 | 118 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @var array |
| 19 | 19 | */ |
| 20 | 20 | protected $cats = [':smiley_cat:', ':smile_cat:', ':heart_eyes_cat:', ':kissing_cat:', |
| 21 | - ':smirk_cat:', ':scream_cat:', ':crying_cat_face:', ':joy_cat:' , ':pouting_cat:', ]; |
|
| 21 | + ':smirk_cat:', ':scream_cat:', ':crying_cat_face:', ':joy_cat:', ':pouting_cat:', ]; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @var array |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public function processMessage() : string |
| 70 | 70 | { |
| 71 | 71 | $message = strtolower($this->payload->getData()['text']); |
| 72 | - $username = '<@' . $this->payload->getData()['user'] . '>'; |
|
| 72 | + $username = '<@'.$this->payload->getData()['user'].'>'; |
|
| 73 | 73 | |
| 74 | 74 | if (strpos($message, 'help') !== false) { |
| 75 | 75 | $result = []; |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $parts = explode(':', $notification['message']); |
| 106 | 106 | $refId = (int) trim($parts[1]); |
| 107 | - $result = $this->queryGerrit('change:' . $refId); |
|
| 108 | - $msg = '*Hi <@' . $user . '>, <@' . $notification['from_user'] . '>' |
|
| 107 | + $result = $this->queryGerrit('change:'.$refId); |
|
| 108 | + $msg = '*Hi <@'.$user.'>, <@'.$notification['from_user'].'>' |
|
| 109 | 109 | . ' ask you to look at this patch:*'; |
| 110 | 110 | |
| 111 | 111 | if (is_array($result)) { |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $parts = explode(':', $notification['message']); |
| 129 | 129 | $issueNumber = (int) trim($parts[1]); |
| 130 | - $result = $this->queryForge('issues/' . $issueNumber); |
|
| 130 | + $result = $this->queryForge('issues/'.$issueNumber); |
|
| 131 | 131 | if ($result) { |
| 132 | - $msg = '*Hi <@' . $user . '>, <@' . $notification['from_user'] . '>' |
|
| 132 | + $msg = '*Hi <@'.$user.'>, <@'.$notification['from_user'].'>' |
|
| 133 | 133 | . ' ask you to look at this issue:*'; |
| 134 | - $this->sendResponse($msg . chr(10) . $this->buildIssueMessage($result->issue), $user); |
|
| 134 | + $this->sendResponse($msg.chr(10).$this->buildIssueMessage($result->issue), $user); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function processTextMessage(array $notification, string $user) |
| 143 | 143 | { |
| 144 | - $msg = '*Hi <@' . $user . '>, here is a message from <@' . $notification['from_user'] . '>' . ' for you:*'; |
|
| 145 | - $this->sendResponse($msg . chr(10) . $notification['message'], $user); |
|
| 144 | + $msg = '*Hi <@'.$user.'>, here is a message from <@'.$notification['from_user'].'>'.' for you:*'; |
|
| 145 | + $this->sendResponse($msg.chr(10).$notification['message'], $user); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -168,6 +168,6 @@ discard block |
||
| 168 | 168 | 'message' => $message, |
| 169 | 169 | ]); |
| 170 | 170 | |
| 171 | - return 'OK, I will tell <@' . $toUser . '> about your message'; |
|
| 171 | + return 'OK, I will tell <@'.$toUser.'> about your message'; |
|
| 172 | 172 | } |
| 173 | 173 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $command = !empty($params[0]) ? $params[0] : 'help'; |
| 100 | 100 | $this->params = $params; |
| 101 | - $method = 'process' . ucfirst(strtolower($command)); |
|
| 101 | + $method = 'process'.ucfirst(strtolower($command)); |
|
| 102 | 102 | if (method_exists($this, $method)) { |
| 103 | 103 | return $this->{$method}(); |
| 104 | 104 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | if ($user !== null) { |
| 117 | 117 | $this->client->apiCall('im.open', ['user' => $user]) |
| 118 | - ->then(function (Payload $response) use ($messageToSent) { |
|
| 118 | + ->then(function(Payload $response) use ($messageToSent) { |
|
| 119 | 119 | $channel = $response->getData()['channel']['id']; |
| 120 | 120 | $this->postMessage($messageToSent, $channel); |
| 121 | 121 | }); |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function getHelp() : string |
| 134 | 134 | { |
| 135 | - $result = '*HELP*' . chr(10); |
|
| 135 | + $result = '*HELP*'.chr(10); |
|
| 136 | 136 | foreach ($this->helpCommands as $command => $helpText) { |
| 137 | - $result .= "*{$this->commandName}:{$command}*: {$helpText}" . chr(10); |
|
| 137 | + $result .= "*{$this->commandName}:{$command}*: {$helpText}".chr(10); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | return $result; |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | break; |
| 179 | 179 | } |
| 180 | 180 | $attachment->setTitle($item->subject); |
| 181 | - $attachment->setTitleLink('https://review.typo3.org/' . $item->_number); |
|
| 181 | + $attachment->setTitleLink('https://review.typo3.org/'.$item->_number); |
|
| 182 | 182 | |
| 183 | - $text .= 'Branch: ' . $this->bold($branch) . ' | :calendar: ' . $this->bold($created) |
|
| 184 | - . ' | ID: ' . $this->bold($item->_number) . chr(10); |
|
| 185 | - $text .= '<https://review.typo3.org/' . $item->_number . '|:arrow_right: Goto Review>'; |
|
| 183 | + $text .= 'Branch: '.$this->bold($branch).' | :calendar: '.$this->bold($created) |
|
| 184 | + . ' | ID: '.$this->bold($item->_number).chr(10); |
|
| 185 | + $text .= '<https://review.typo3.org/'.$item->_number.'|:arrow_right: Goto Review>'; |
|
| 186 | 186 | |
| 187 | 187 | $attachment->setText($text); |
| 188 | 188 | $attachment->setFallback($text); |