@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -(new Dotenv\Dotenv(__DIR__ . '/../'))->load(); |
|
| 3 | +(new Dotenv\Dotenv(__DIR__.'/../'))->load(); |
|
| 4 | 4 | |
| 5 | 5 | $GLOBALS['config'] = [ |
| 6 | 6 | // project phase |
@@ -58,15 +58,15 @@ discard block |
||
| 58 | 58 | $countMinus2 = count($result); |
| 59 | 59 | |
| 60 | 60 | $returnString = ''; |
| 61 | - $returnString .= 'There are currently ' . $this->bold($count) . ' open reviews for project ' |
|
| 62 | - . $this->italic($project) . ' and branch master on <https://review.typo3.org/#/q/project:' . $project |
|
| 63 | - . '+status:open+branch:master|https://review.typo3.org>' . chr(10); |
|
| 64 | - $returnString .= $this->bold($countMinus1) . ' of ' . $this->bold($count) . ' open reviews voted with ' |
|
| 65 | - . $this->bold('-1') . ' <https://review.typo3.org/#/q/label:Code-Review%253D-1+is:open+branch:' |
|
| 66 | - . 'master+project:' . $project . '|Check now> ' . chr(10); |
|
| 67 | - $returnString .= $this->bold($countMinus2) . ' of ' . $this->bold($count) . ' open reviews voted with ' |
|
| 68 | - . $this->bold('-2') . ' <https://review.typo3.org/#/q/label:Code-Review%253D-2+is:open+branch:' |
|
| 69 | - . 'master+project:' . $project . '|Check now>'; |
|
| 61 | + $returnString .= 'There are currently '.$this->bold($count).' open reviews for project ' |
|
| 62 | + . $this->italic($project).' and branch master on <https://review.typo3.org/#/q/project:'.$project |
|
| 63 | + . '+status:open+branch:master|https://review.typo3.org>'.chr(10); |
|
| 64 | + $returnString .= $this->bold($countMinus1).' of '.$this->bold($count).' open reviews voted with ' |
|
| 65 | + . $this->bold('-1').' <https://review.typo3.org/#/q/label:Code-Review%253D-1+is:open+branch:' |
|
| 66 | + . 'master+project:'.$project.'|Check now> '.chr(10); |
|
| 67 | + $returnString .= $this->bold($countMinus2).' of '.$this->bold($count).' open reviews voted with ' |
|
| 68 | + . $this->bold('-2').' <https://review.typo3.org/#/q/label:Code-Review%253D-2+is:open+branch:' |
|
| 69 | + . 'master+project:'.$project.'|Check now>'; |
|
| 70 | 70 | |
| 71 | 71 | return $returnString; |
| 72 | 72 | } |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | if ($username === null) { |
| 98 | 98 | return 'hey, I need a username!'; |
| 99 | 99 | } |
| 100 | - $results = $this->queryGerrit('is:open owner:"' . $username . '" project:' . $project); |
|
| 100 | + $results = $this->queryGerrit('is:open owner:"'.$username.'" project:'.$project); |
|
| 101 | 101 | if (count($results) > 0) { |
| 102 | - $listOfItems = ['*Here are the results for ' . $username . '*:']; |
|
| 102 | + $listOfItems = ['*Here are the results for '.$username.'*:']; |
|
| 103 | 103 | if (is_array($results)) { |
| 104 | 104 | foreach ($results as $item) { |
| 105 | 105 | $listOfItems[] = $this->buildReviewLine($item); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | return implode(chr(10), $listOfItems); |
| 110 | 110 | } |
| 111 | - return $username . ' has no open reviews or username is unknown'; |
|
| 111 | + return $username.' has no open reviews or username is unknown'; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $paramsCount = count($this->params); |
| 147 | 147 | $changeIds = []; |
| 148 | 148 | for ($i = 1; $i < $paramsCount; ++$i) { |
| 149 | - $changeIds[] = 'change:' . $this->params[$i]; |
|
| 149 | + $changeIds[] = 'change:'.$this->params[$i]; |
|
| 150 | 150 | } |
| 151 | 151 | $result = $this->queryGerrit(implode(' OR ', $changeIds)); |
| 152 | 152 | $listOfItems = []; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | protected function buildReviewMessageOutput(int $refId) |
| 167 | 167 | { |
| 168 | - $result = $this->queryGerrit('change:' . $refId); |
|
| 168 | + $result = $this->queryGerrit('change:'.$refId); |
|
| 169 | 169 | if (!$result) { |
| 170 | 170 | return "{$refId} not found, sorry!"; |
| 171 | 171 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | return 'hey, I need a query!'; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - $results = $this->queryGerrit('limit:50 ' . $query); |
|
| 196 | + $results = $this->queryGerrit('limit:50 '.$query); |
|
| 197 | 197 | if (count($results) > 0) { |
| 198 | 198 | $listOfItems = ["*Here are the results for {$query}*:"]; |
| 199 | 199 | if (is_array($results)) { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | $cnt = count($result); |
| 225 | 225 | |
| 226 | - return 'Good job folks, since ' . $date . ' you merged *' . $cnt . '* patches into master'; |
|
| 226 | + return 'Good job folks, since '.$date.' you merged *'.$cnt.'* patches into master'; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $command = !empty($params[0]) ? $params[0] : 'help'; |
| 90 | 90 | $this->params = $params; |
| 91 | - $method = 'process' . ucfirst(strtolower($command)); |
|
| 91 | + $method = 'process'.ucfirst(strtolower($command)); |
|
| 92 | 92 | if (method_exists($this, $method)) { |
| 93 | 93 | return $this->{$method}(); |
| 94 | 94 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | if ($user !== null) { |
| 107 | 107 | $this->client->apiCall('im.open', ['user' => $user]) |
| 108 | - ->then(function (Payload $response) use ($messageToSent) { |
|
| 108 | + ->then(function(Payload $response) use ($messageToSent) { |
|
| 109 | 109 | $channel = $response->getData()['channel']['id']; |
| 110 | 110 | $this->postMessage($messageToSent, $channel); |
| 111 | 111 | }); |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | break; |
| 169 | 169 | } |
| 170 | 170 | $attachment->setTitle($item->subject); |
| 171 | - $attachment->setTitleLink('https://review.typo3.org/' . $item->_number); |
|
| 171 | + $attachment->setTitleLink('https://review.typo3.org/'.$item->_number); |
|
| 172 | 172 | |
| 173 | - $text .= 'Branch: ' . $this->bold($branch) . ' | :calendar: ' . $this->bold($created) |
|
| 174 | - . ' | ID: ' . $this->bold($item->_number) . "\n"; |
|
| 175 | - $text .= '<https://review.typo3.org/' . $item->_number . '|:arrow_right: Goto Review>'; |
|
| 173 | + $text .= 'Branch: '.$this->bold($branch).' | :calendar: '.$this->bold($created) |
|
| 174 | + . ' | ID: '.$this->bold($item->_number)."\n"; |
|
| 175 | + $text .= '<https://review.typo3.org/'.$item->_number.'|:arrow_right: Goto Review>'; |
|
| 176 | 176 | |
| 177 | 177 | $attachment->setText($text); |
| 178 | 178 | $attachment->setFallback($text); |
@@ -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 | } |