Passed
Push — master ( 465b3e...ec2791 )
by Leonardo
01:39
created

Webhook::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace LeoCarmo\TelegramBot\Model;
4
5
class Webhook extends Model
6
{
7
8
    /**
9
     * @var string
10
     */
11
    protected $method;
12
13
    /**
14
     * @var string
15
     */
16
    protected $url;
17
18
    /**
19
     * @var
20
     */
21
    protected $certificate;
22
23
    /**
24
     * @var integer
25
     */
26
    protected $max_connections;
27
28
    /**
29
     * @var array
30
     */
31
    protected $allowed_updates;
32
33
    /**
34
     * HTTPS url to send updates to.
35
     * Use an empty string to remove webhook integration
36
     *
37
     * @param string $url
38
     * @return array
39
     * @throws \LeoCarmo\TelegramBot\Exceptions\RequiredParameterException
40
     */
41
    public function set(string $url)
42
    {
43
        $this->url = $url;
44
45
        $this->method = 'setWebhook';
46
47
        return $this->send();
48
    }
49
50
    /**
51
     * Use this method to remove webhook integration if you decide to switch back to getUpdates
52
     *
53
     * @return array
54
     * @throws \LeoCarmo\TelegramBot\Exceptions\RequiredParameterException
55
     */
56
    public function delete()
57
    {
58
        $this->method = 'deleteWebhook';
59
60
        return $this->send();
61
    }
62
63
    /**
64
     * Use this method to get current webhook status
65
     *
66
     * @return array
67
     * @throws \LeoCarmo\TelegramBot\Exceptions\RequiredParameterException
68
     */
69
    public function get()
70
    {
71
        $this->method = 'getWebhookInfo';
72
73
        return $this->send();
74
    }
75
76
}