Total Complexity | 5 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 5 | ||
Bugs | 2 | Features | 0 |
1 | <?php |
||
8 | class WebhookService |
||
9 | { |
||
10 | protected Webhook $webhook; |
||
11 | |||
12 | public function __construct(?Webhook $webhook = null) |
||
13 | { |
||
14 | $this->webhook = $webhook ?? new Webhook(); |
||
15 | $this->webhook->setToken(config('telegram-git-notifier.bot.token')); |
||
16 | $this->webhook->setUrl(config('telegram-git-notifier.app.url')); |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * Set webhook for telegram bot. |
||
21 | * |
||
22 | * @return string |
||
23 | * |
||
24 | * @throws WebhookException |
||
25 | */ |
||
26 | public function setWebhook(): string |
||
27 | { |
||
28 | return $this->webhook->setWebhook(); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Delete webhook for telegram bot. |
||
33 | * |
||
34 | * @return string |
||
35 | * |
||
36 | * @throws WebhookException |
||
37 | */ |
||
38 | public function deleteWebHook(): string |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Get webhook update. |
||
45 | * |
||
46 | * @return string |
||
47 | * |
||
48 | * @throws WebhookException |
||
49 | */ |
||
50 | public function getUpdates(): string |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Get webhook info. |
||
57 | * |
||
58 | * @return string |
||
59 | * |
||
60 | * @throws WebhookException |
||
61 | */ |
||
62 | public function getWebHookInfo(): string |
||
65 | } |
||
66 | } |
||
67 |