@@ -75,7 +75,7 @@ |
||
| 75 | 75 | <div class="result" style="text-align: left;"> |
| 76 | 76 | <pre><?php foreach ($result as $row) { |
| 77 | 77 | ?> |
| 78 | -<?= $row . "\n" ?> |
|
| 78 | +<?= $row."\n" ?> |
|
| 79 | 79 | <?php |
| 80 | 80 | } ?></pre> |
| 81 | 81 | </div> |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function processMessage() : string |
| 29 | 29 | { |
| 30 | 30 | $message = strtolower($this->payload->getData()['text']); |
| 31 | - $username = '<@' . $this->payload->getData()['user'] . '>'; |
|
| 31 | + $username = '<@'.$this->payload->getData()['user'].'>'; |
|
| 32 | 32 | |
| 33 | 33 | if (strpos($message, 'help') !== false) { |
| 34 | 34 | $links = [ |
@@ -46,29 +46,29 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $cats = [':smiley_cat:', ':smile_cat:', ':heart_eyes_cat:', ':kissing_cat:', ':smirk_cat:', ':scream_cat:', |
| 49 | - ':crying_cat_face:', ':joy_cat:' , ':pouting_cat:', ]; |
|
| 49 | + ':crying_cat_face:', ':joy_cat:', ':pouting_cat:', ]; |
|
| 50 | 50 | |
| 51 | 51 | $responses = [ |
| 52 | 52 | 'daddy' => 'My daddy is Frank Nägler aka <@neoblack>', |
| 53 | - 'n8' => 'Good night ' . $username . '! :sleeping:', |
|
| 54 | - 'nacht' => 'Good night ' . $username . '! :sleeping:', |
|
| 55 | - 'night' => 'Good night ' . $username . '! :sleeping:', |
|
| 56 | - 'hello' => 'Hello ' . $username . ', nice to see you!', |
|
| 57 | - 'hallo' => 'Hello ' . $username . ', nice to see you!', |
|
| 58 | - 'ciao' => 'Bye, bye ' . $username . ', cu later alligator! :wave:', |
|
| 59 | - 'cu' => 'Bye, bye ' . $username . ', cu later alligator! :wave:', |
|
| 60 | - 'thx' => 'You are welcome ' . $username . '!', |
|
| 61 | - 'thank' => 'You are welcome ' . $username . '!', |
|
| 62 | - 'drink' => 'Coffee or beer ' . $username . '?', |
|
| 63 | - 'coffee' => 'Here is a :coffee: for you ' . $username . '!', |
|
| 64 | - 'beer' => 'Here is a :t3beer: for you ' . $username . '!', |
|
| 65 | - 'coke' => 'Coke is unhealthy ' . $username . '!', |
|
| 66 | - 'cola' => 'Coke is unhealthy ' . $username . '!', |
|
| 67 | - 'cookie' => 'Here is a :cookie: for you ' . $username . '!', |
|
| 53 | + 'n8' => 'Good night '.$username.'! :sleeping:', |
|
| 54 | + 'nacht' => 'Good night '.$username.'! :sleeping:', |
|
| 55 | + 'night' => 'Good night '.$username.'! :sleeping:', |
|
| 56 | + 'hello' => 'Hello '.$username.', nice to see you!', |
|
| 57 | + 'hallo' => 'Hello '.$username.', nice to see you!', |
|
| 58 | + 'ciao' => 'Bye, bye '.$username.', cu later alligator! :wave:', |
|
| 59 | + 'cu' => 'Bye, bye '.$username.', cu later alligator! :wave:', |
|
| 60 | + 'thx' => 'You are welcome '.$username.'!', |
|
| 61 | + 'thank' => 'You are welcome '.$username.'!', |
|
| 62 | + 'drink' => 'Coffee or beer '.$username.'?', |
|
| 63 | + 'coffee' => 'Here is a :coffee: for you '.$username.'!', |
|
| 64 | + 'beer' => 'Here is a :t3beer: for you '.$username.'!', |
|
| 65 | + 'coke' => 'Coke is unhealthy '.$username.'!', |
|
| 66 | + 'cola' => 'Coke is unhealthy '.$username.'!', |
|
| 67 | + 'cookie' => 'Here is a :cookie: for you '.$username.'!', |
|
| 68 | 68 | 'typo3' => ':typo3: TYPO3 CMS is the best open source CMS of the world!', |
| 69 | 69 | 'dark' => 'sure, we have cookies :cookie:', |
| 70 | - 'cat' => 'ok, here is some cat content ' . $cats[array_rand($cats)], |
|
| 71 | - 'love' => 'I love you too, ' . $username . ':kiss:', |
|
| 70 | + 'cat' => 'ok, here is some cat content '.$cats[array_rand($cats)], |
|
| 71 | + 'love' => 'I love you too, '.$username.':kiss:', |
|
| 72 | 72 | ]; |
| 73 | 73 | $messageToSend = ''; |
| 74 | 74 | foreach ($responses as $keyword => $response) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | protected function processAll() : string |
| 50 | 50 | { |
| 51 | - return 'Yeah, ' . $this->getBeerCountAll() . ' :t3beer: spend to all people'; |
|
| 51 | + return 'Yeah, '.$this->getBeerCountAll().' :t3beer: spend to all people'; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $rows = $this->getBeerTop10(); |
| 64 | 64 | $text = ['*Yeah, here are the TOP 10*']; |
| 65 | 65 | foreach ($rows as $row) { |
| 66 | - $text[] = '<@' . $row['username'] . '> has received ' . $row['cnt'] . ' :t3beer:'; |
|
| 66 | + $text[] = '<@'.$row['username'].'> has received '.$row['cnt'].' :t3beer:'; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return implode(chr(10), $text); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | if (strpos($username, '<') === 0 && $username[1] === '@') { |
| 85 | 85 | $username = str_replace(['<', '>', '@'], '', $username); |
| 86 | 86 | |
| 87 | - return '<@' . $username . '> has received ' . $this->getBeerCountByUsername($username) . ' :t3beer: so far'; |
|
| 87 | + return '<@'.$username.'> has received '.$this->getBeerCountByUsername($username).' :t3beer: so far'; |
|
| 88 | 88 | } |
| 89 | 89 | return '*Sorry, a username must start with a @-sign:*'; |
| 90 | 90 | } |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | 'tstamp' => time() |
| 129 | 129 | ]; |
| 130 | 130 | $this->getDatabaseConnection()->insert('beers', $data); |
| 131 | - return 'Yeah, one more :t3beer: for <@' . $username . '>' . chr(10) . '<@' . $username . '> has received ' |
|
| 132 | - . $this->getBeerCountByUsername($username) . ' :t3beer: so far'; |
|
| 131 | + return 'Yeah, one more :t3beer: for <@'.$username.'>'.chr(10).'<@'.$username.'> has received ' |
|
| 132 | + . $this->getBeerCountByUsername($username).' :t3beer: so far'; |
|
| 133 | 133 | } |
| 134 | - return 'You spend one :t3beer: to <@' . $username . '> within in last 24 hours. Too much beer is unhealthy ;)'; |
|
| 134 | + return 'You spend one :t3beer: to <@'.$username.'> within in last 24 hours. Too much beer is unhealthy ;)'; |
|
| 135 | 135 | } |
| 136 | 136 | return '*Sorry, a username must start with a @-sign:*'; |
| 137 | 137 | } |
@@ -54,6 +54,6 @@ |
||
| 54 | 54 | |
| 55 | 55 | $option = $options[random_int(0, count($options) - 1)]; |
| 56 | 56 | |
| 57 | - return '*Botty says:* _' . $option . '_'; |
|
| 57 | + return '*Botty says:* _'.$option.'_'; |
|
| 58 | 58 | } |
| 59 | 59 | } |
@@ -43,14 +43,14 @@ |
||
| 43 | 43 | $message = $this->payload->getData()['text']; |
| 44 | 44 | $parts = explode(':', $message); |
| 45 | 45 | $command = ucfirst(strtolower($parts[0])); |
| 46 | - $commandClass = '\\T3Bot\\Commands\\' . $command . 'Command'; |
|
| 46 | + $commandClass = '\\T3Bot\\Commands\\'.$command.'Command'; |
|
| 47 | 47 | if (class_exists($commandClass)) { |
| 48 | 48 | return new $commandClass($this->payload, $this->client); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $parts = explode(' ', $message); |
| 52 | 52 | $command = ucfirst(strtolower($parts[0])); |
| 53 | - $commandClass = '\\T3Bot\\Commands\\' . $command . 'Command'; |
|
| 53 | + $commandClass = '\\T3Bot\\Commands\\'.$command.'Command'; |
|
| 54 | 54 | if (class_exists($commandClass)) { |
| 55 | 55 | return new $commandClass($this->payload, $this->client); |
| 56 | 56 | } |
@@ -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 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | protected function bold($string) : string |
| 25 | 25 | { |
| 26 | - return '*' . $string . '*'; |
|
| 26 | + return '*'.$string.'*'; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected function italic($string) : string |
| 37 | 37 | { |
| 38 | - return '_' . $string . '_'; |
|
| 38 | + return '_'.$string.'_'; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | protected function buildReviewLine($item) : string |
| 49 | 49 | { |
| 50 | - return $this->bold($item->subject) . ' <https://review.typo3.org/' . $item->_number |
|
| 51 | - . '|Review #' . $item->_number . ' now>'; |
|
| 50 | + return $this->bold($item->subject).' <https://review.typo3.org/'.$item->_number |
|
| 51 | + . '|Review #'.$item->_number.' now>'; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -60,15 +60,15 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $created = substr($item->created_on, 0, 19); |
| 62 | 62 | $updated = substr($item->updated_on, 0, 19); |
| 63 | - $text = $this->bold('[' . $item->tracker->name . '] ' . $item->subject) |
|
| 64 | - . ' by ' . $this->italic($item->author->name) . "\n"; |
|
| 65 | - $text .= 'Project: ' . $this->bold($item->project->name); |
|
| 63 | + $text = $this->bold('['.$item->tracker->name.'] '.$item->subject) |
|
| 64 | + . ' by '.$this->italic($item->author->name)."\n"; |
|
| 65 | + $text .= 'Project: '.$this->bold($item->project->name); |
|
| 66 | 66 | if (!empty($item->category->name)) { |
| 67 | - $text .= ' | Category: ' . $this->bold($item->category->name); |
|
| 67 | + $text .= ' | Category: '.$this->bold($item->category->name); |
|
| 68 | 68 | } |
| 69 | - $text .= ' | Status: ' . $this->bold($item->status->name) . "\n"; |
|
| 70 | - $text .= ':calendar: Created: ' . $this->bold($created) . ' | Last update: ' . $this->bold($updated) . "\n"; |
|
| 71 | - $text .= '<https://forge.typo3.org/issues/' . $item->id . '|:arrow_right: View on Forge>'; |
|
| 69 | + $text .= ' | Status: '.$this->bold($item->status->name)."\n"; |
|
| 70 | + $text .= ':calendar: Created: '.$this->bold($created).' | Last update: '.$this->bold($updated)."\n"; |
|
| 71 | + $text .= '<https://forge.typo3.org/issues/'.$item->id.'|:arrow_right: View on Forge>'; |
|
| 72 | 72 | |
| 73 | 73 | return $text; |
| 74 | 74 | } |
@@ -47,7 +47,7 @@ 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 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $attachment = new Message\Attachment(); |
| 57 | 57 | |
| 58 | 58 | $attachment->setColor(Message\Attachment::COLOR_NOTICE); |
| 59 | - $attachment->setTitle('[NEW] ' . $item->subject); |
|
| 59 | + $attachment->setTitle('[NEW] '.$item->subject); |
|
| 60 | 60 | |
| 61 | 61 | $text = "Branch: *{$branch}* | :calendar: _{$created}_ | ID: {$item->_number}\n"; |
| 62 | 62 | $text .= ":link: <https://review.typo3.org/{$item->_number}|Review now>"; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | break; |
| 74 | 74 | case 'change-merged': |
| 75 | 75 | /** @var array $item */ |
| 76 | - $item = $this->queryGerrit('change:' . $patchId); |
|
| 76 | + $item = $this->queryGerrit('change:'.$patchId); |
|
| 77 | 77 | $item = $item[0]; |
| 78 | 78 | /* @var \stdClass $item */ |
| 79 | 79 | $created = substr($item->created, 0, 19); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $attachment = new Message\Attachment(); |
| 84 | 84 | |
| 85 | 85 | $attachment->setColor(Message\Attachment::COLOR_GOOD); |
| 86 | - $attachment->setTitle(':white_check_mark: [MERGED] ' . $item->subject); |
|
| 86 | + $attachment->setTitle(':white_check_mark: [MERGED] '.$item->subject); |
|
| 87 | 87 | |
| 88 | 88 | $text = "Branch: {$branch} | :calendar: {$created} | ID: {$item->_number}\n"; |
| 89 | 89 | $text .= ":link: <https://review.typo3.org/{$item->_number}|Goto Review>"; |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | $attachment->setTitle('A documentation file has been updated'); |
| 127 | 127 | break; |
| 128 | 128 | } |
| 129 | - $text = ':link: <https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/' . $fileName |
|
| 130 | - . '|' . $fileName . '>'; |
|
| 129 | + $text = ':link: <https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/'.$fileName |
|
| 130 | + . '|'.$fileName.'>'; |
|
| 131 | 131 | $attachment->setText($text); |
| 132 | 132 | $attachment->setFallback($text); |
| 133 | 133 | $message->addAttachment($attachment); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__ . '/config/config.php'; |
|
| 3 | +require_once __DIR__.'/config/config.php'; |
|
| 4 | 4 | |
| 5 | 5 | return $GLOBALS['config']['db']; |