WebhookAction   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 7
c 2
b 1
f 1
dl 0
loc 55
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getUpdates() 0 3 1
A set() 0 3 1
A delete() 0 3 1
A getWebHookInfo() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace CSlant\LaravelTelegramGitNotifier\Http\Actions;
4
5
use CSlant\LaravelTelegramGitNotifier\Services\WebhookService;
6
use CSlant\TelegramGitNotifier\Exceptions\WebhookException;
7
8
class WebhookAction
9
{
10
    protected WebhookService $webhookService;
11
12
    public function __construct()
13
    {
14
        $this->webhookService = new WebhookService();
15
    }
16
17
    /**
18
     * Set webhook for telegram bot.
19
     *
20
     * @return string
21
     *
22
     * @throws WebhookException
23
     */
24
    public function set(): string
25
    {
26
        return $this->webhookService->setWebhook();
27
    }
28
29
    /**
30
     * Delete webhook for telegram bot.
31
     *
32
     * @return string
33
     *
34
     * @throws WebhookException
35
     */
36
    public function delete(): string
37
    {
38
        return $this->webhookService->deleteWebHook();
39
    }
40
41
    /**
42
     * Get webhook update.
43
     *
44
     * @return string
45
     *
46
     * @throws WebhookException
47
     */
48
    public function getUpdates(): string
49
    {
50
        return $this->webhookService->getUpdates();
51
    }
52
53
    /**
54
     * Get webhook info.
55
     *
56
     * @return string
57
     *
58
     * @throws WebhookException
59
     */
60
    public function getWebHookInfo(): string
61
    {
62
        return $this->webhookService->getWebHookInfo();
63
    }
64
}
65