Skip to content

Commit 984c930

Browse files
refactor: optimize set webhook command 1
1 parent 476db7d commit 984c930

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Commands/SetWebhook.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class SetWebhook extends Command
3030
public function handle(): void
3131
{
3232
try {
33-
$log = (new WebhookService())->setWebhook();
33+
$webhookService = new WebhookService();
3434

35-
$this->info($log);
35+
$this->info($webhookService->setWebhook());
3636
} catch (WebhookException $e) {
3737
$this->error($e->getMessage());
3838
}

src/Services/WebhookService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ class WebhookService
99
{
1010
protected Webhook $webhook;
1111

12-
public function __construct()
12+
public function __construct(?Webhook $webhook = null)
1313
{
14-
$this->webhook = new Webhook();
14+
$this->webhook = $webhook ?? new Webhook();
1515
$this->webhook->setToken(config('telegram-git-notifier.bot.token'));
1616
$this->webhook->setUrl(config('telegram-git-notifier.app.url'));
1717
}

0 commit comments

Comments
 (0)