Skip to content

Commit 28baab4

Browse files
tanhongitgithub-actions[bot]
authored andcommitted
Fix styling
1 parent f9575da commit 28baab4

File tree

6 files changed

+28
-23
lines changed

6 files changed

+28
-23
lines changed

src/Http/Actions/IndexAction.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ public function __invoke(): void
6060
{
6161
if ($this->bot->isCallback()) {
6262
$this->handleCallback();
63+
6364
return;
6465
}
6566

6667
if ($this->shouldHandleCommand()) {
6768
$this->handleCommand();
69+
6870
return;
6971
}
7072

src/Services/CallbackService.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static function create(Bot $bot): self
4343
public function answerBackButton(string $callback): void
4444
{
4545
$callback = str_replace(SettingConstant::SETTING_BACK, '', $callback);
46-
46+
4747
$result = match ($callback) {
4848
'settings' => $this->handleSettingsBack(),
4949
'settings.custom_events.github' => $this->handleGithubEventsBack(),
@@ -54,13 +54,14 @@ public function answerBackButton(string $callback): void
5454

5555
if ($result === null) {
5656
$this->bot->answerCallbackQuery(__('tg-notifier::app.unknown_callback'));
57+
5758
return;
5859
}
5960

6061
['view' => $view, 'markup' => $markup] = $result;
6162
$this->bot->editMessageText($view, ['reply_markup' => $markup]);
6263
}
63-
64+
6465
/**
6566
* Handle settings back button.
6667
*
@@ -73,7 +74,7 @@ private function handleSettingsBack(): array
7374
'markup' => $this->bot->settingMarkup(),
7475
];
7576
}
76-
77+
7778
/**
7879
* Handle GitHub events back button.
7980
*
@@ -86,7 +87,7 @@ private function handleGithubEventsBack(): array
8687
'markup' => $this->bot->eventMarkup(),
8788
];
8889
}
89-
90+
9091
/**
9192
* Handle GitLab events back button.
9293
*
@@ -99,7 +100,7 @@ private function handleGitlabEventsBack(): array
99100
'markup' => $this->bot->eventMarkup(null, 'gitlab'),
100101
];
101102
}
102-
103+
103104
/**
104105
* Handle menu back button.
105106
*
@@ -142,6 +143,7 @@ private function handleCustomEvents(string $callback): bool
142143
}
143144

144145
$this->bot->eventHandle($callback);
146+
145147
return true;
146148
}
147149

@@ -155,6 +157,7 @@ private function handleBackButton(string $callback): bool
155157
}
156158

157159
$this->answerBackButton($callback);
160+
158161
return true;
159162
}
160163

src/Services/CommandService.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use CSlant\TelegramGitNotifier\Exceptions\EntryNotFoundException;
1010
use CSlant\TelegramGitNotifier\Exceptions\MessageIsEmptyException;
1111
use Illuminate\Support\Facades\Config;
12-
use Telegram\Telegram as TelegramSDK;
1312

1413
class CommandService
1514
{
@@ -41,7 +40,7 @@ private function sendStartMessage(): void
4140
$firstName = $this->bot->telegram->FirstName() ?: 'there';
4241
$reply = view("$this->viewNamespace::tools.start", ['first_name' => $firstName]);
4342
$imagePath = __DIR__.'/../../resources/images/telegram-git-notifier-laravel.png';
44-
43+
4544
$this->bot->sendPhoto($imagePath, ['caption' => $reply]);
4645
}
4746

@@ -57,11 +56,11 @@ public function handle(): void
5756
$command = trim($text, '/');
5857

5958
$handlers = [
60-
'start' => fn() => $this->handleStart(),
61-
'menu' => fn() => $this->handleMenu(),
62-
'settings' => fn() => $this->handleSettings(),
63-
'set_menu' => fn() => $this->handleSetMenu(),
64-
'default' => fn() => $this->handleDefault($command),
59+
'start' => fn () => $this->handleStart(),
60+
'menu' => fn () => $this->handleMenu(),
61+
'settings' => fn () => $this->handleSettings(),
62+
'set_menu' => fn () => $this->handleSetMenu(),
63+
'default' => fn () => $this->handleDefault($command),
6564
];
6665

6766
$handler = $handlers[$command] ?? $this->handleToolCommand($command) ?? $handlers['default'];
@@ -119,7 +118,7 @@ private function handleSetMenu(): void
119118
private function handleToolCommand(string $command): ?callable
120119
{
121120
$toolCommands = ['token', 'id', 'usage', 'server'];
122-
121+
123122
if (!in_array($command, $toolCommands, true)) {
124123
return null;
125124
}

src/Services/NotificationService.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
class NotificationService
1616
{
17-
/**
18-
* @var array<string, array<int|string>>
17+
/**
18+
* @var array<string, array<int|string>>
1919
*/
2020
private array $chatIds = [];
2121

@@ -51,11 +51,11 @@ private function initialize(): void
5151
public function handle(): void
5252
{
5353
$eventName = $this->notifier->handleEventFromRequest($this->request);
54-
54+
5555
if ($eventName === null) {
5656
return;
5757
}
58-
58+
5959
$this->sendNotification($eventName);
6060
}
6161

@@ -92,6 +92,7 @@ private function sendToRecipients(string $chatId, array $threads): void
9292
{
9393
if (empty($threads)) {
9494
$this->sendToChat($chatId);
95+
9596
return;
9697
}
9798

@@ -106,7 +107,7 @@ private function sendToRecipients(string $chatId, array $threads): void
106107
private function sendToChat(string $chatId): void
107108
{
108109
$this->notifier->sendNotify(null, [
109-
'chat_id' => $chatId
110+
'chat_id' => $chatId,
110111
]);
111112
}
112113

@@ -145,7 +146,7 @@ private function sendToThread(string $chatId, string $threadId): void
145146
private function isValidEvent(string $event): bool
146147
{
147148
$payload = $this->notifier->setPayload($this->request, $event);
148-
149+
149150
if (empty($payload) || !is_object($payload)) {
150151
return false;
151152
}
@@ -162,7 +163,7 @@ private function isValidEvent(string $event): bool
162163
private function validateEventAccess(string $event, object $payload): bool
163164
{
164165
$validator = new Validator($this->setting, $this->notifier->event);
165-
166+
166167
return $validator->isAccessEvent(
167168
$this->notifier->event->platform,
168169
$event,

src/Services/WebhookService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private function initializeWebhook(): void
7373
if ($this->webhook->getToken() === null) {
7474
$this->webhook->setToken(Config::get(self::CONFIG_PREFIX . '.bot.token'));
7575
}
76-
76+
7777
if ($this->webhook->getUrl() === null) {
7878
$this->webhook->setUrl(Config::get(self::CONFIG_PREFIX . '.app.url'));
7979
}

src/Traits/Markup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace CSlant\LaravelTelegramGitNotifier\Traits;
66

7-
use Telegram as TelegramSDK;
87
use Illuminate\Support\Facades\Config;
8+
use Telegram as TelegramSDK;
99

1010
/**
1111
* Trait Markup
12-
*
12+
*
1313
* Provides common markup generation methods for Telegram bot interfaces.
1414
*/
1515
trait Markup

0 commit comments

Comments
 (0)