Completed
Push — master ( 588078...30ae0c )
by Nikolay
04:51 queued 02:15
created

SetWebhookMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 56
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Method;
6
7
use Greenplugin\TelegramBot\Method\Interfaces\HasUpdateTypeVariableInterface;
8
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
9
use Greenplugin\TelegramBot\Type\InputFileType;
10
11
/**
12
 * Class SetWebhookMethod.
13
 *
14
 * @see https://core.telegram.org/bots/api#setwebhook
15
 * @see https://core.telegram.org/bots/webhooks
16
 */
17
class SetWebhookMethod implements HasUpdateTypeVariableInterface
18
{
19
    use FillFromArrayTrait;
20
21
    /**
22
     * HTTPS url to send updates to. Use an empty string to remove webhook integration.
23
     *
24
     * @var string
25
     */
26
    public $url;
27
28
    /**
29
     * Optional. Upload your public key certificate so that the root certificate in use can be checked.
30
     *
31
     * @see https://core.telegram.org/bots/self-signed
32
     *
33
     * @var InputFileType|null
34
     */
35
    public $certificate;
36
37
    /**
38
     * Optional    Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100.
39
     * Defaults to 40. Use lower values to limit the load on your bot‘s server,
40
     * and higher values to increase your bot’s throughput.
41
     *
42
     * @var int|null
43
     */
44
    public $maxConnections;
45
46
    /**
47
     * Optional    List the types of updates you want your bot to receive.
48
     * For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types.
49
     * See Update for a complete list of available update types.
50
     * Specify an empty list to receive all updates regardless of type (default).
51
     * If not specified, the previous setting will be used.
52
     *
53
     * Please note that this parameter doesn't affect updates created before the call to the setWebhook,
54
     * so unwanted updates may be received for a short period of time.
55
     *
56
     * @var string[]|null
57
     */
58
    public $allowedUpdates;
59
60
    /**
61
     * SetWebhookMethod constructor.
62
     *
63
     * @param string     $url
64
     * @param array|null $data
65
     *
66
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
67
     */
68
    public function __construct(string $url, array $data = null)
69
    {
70
        $this->$url;
71
        if ($data) {
72
            $this->fill($data);
73
        }
74
    }
75
}
76