WebhookInfo::setLastErrorMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * User: boshurik
4
 * Date: 10.06.2020
5
 * Time: 19:43
6
 */
7
8
namespace TelegramBot\Api\Types;
9
10
use TelegramBot\Api\BaseType;
11
use TelegramBot\Api\TypeInterface;
12
13
/**
14
 * Contains information about the current status of a webhook.
15
 *
16
 * @package TelegramBot\Api\Types
17
 */
18
class WebhookInfo extends BaseType implements TypeInterface
19
{
20
    /**
21
     * {@inheritdoc}
22
     *
23
     * @var array
24
     */
25
    protected static $requiredParams = ['url', 'has_custom_certificate', 'pending_update_count'];
26
27
    /**
28
     * {@inheritdoc}
29
     *
30
     * @var array
31
     */
32
    protected static $map = [
33
        'url' => true,
34
        'has_custom_certificate' => true,
35
        'pending_update_count' => true,
36
        'ip_address' => true,
37
        'last_error_date' => true,
38
        'last_error_message' => true,
39
        'last_synchronization_error_date' => true,
40
        'max_connections' => true,
41
        'allowed_updates' => true
42
    ];
43
44
    /**
45
     * Webhook URL, may be empty if webhook is not set up
46
     *
47
     * @var string
48
     */
49
    protected $url;
50
51
    /**
52
     * True, if a custom certificate was provided for webhook certificate checks
53
     *
54
     * @var bool
55
     */
56
    protected $hasCustomCertificate;
57
58
    /**
59
     * Number of updates awaiting delivery
60
     *
61
     * @var int
62
     */
63
    protected $pendingUpdateCount;
64
65
    /**
66
     * Optional. Currently used webhook IP address
67
     *
68
     * @var string|null
69
     */
70
    protected $ipAddress;
71
72
    /**
73
     * Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook
74
     *
75
     * @var int|null
76
     */
77
    protected $lastErrorDate;
78
79
    /**
80
     * Optional. Error message in human-readable format for the most recent error that happened when trying to deliver
81
     * an update via webhook
82
     *
83
     * @var string|null
84
     */
85
    protected $lastErrorMessage;
86
87
    /**
88
     * Optional. Unix time of the most recent error that happened when trying to synchronize available updates
89
     * with Telegram datacenters
90
     *
91
     * @var int|null
92
     */
93
    protected $lastSynchronizationErrorDate;
94
95
    /**
96
     * Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
97
     *
98
     * @var int|null
99
     */
100
    protected $maxConnections;
101
102
    /**
103
     * Optional. A list of update types the bot is subscribed to. Defaults to all update types
104
     *
105
     * @var array|null
106
     */
107
    protected $allowedUpdates;
108
109
    /**
110
     * @return string
111
     */
112 1
    public function getUrl()
113
    {
114 1
        return $this->url;
115
    }
116
117
    /**
118
     * @param string $url
119
     *
120 1
     * @return void
121
     */
122 1
    public function setUrl($url)
123 1
    {
124
        $this->url = $url;
125
    }
126
127
    /**
128 1
     * @return bool
129
     */
130 1
    public function hasCustomCertificate()
131
    {
132
        return $this->hasCustomCertificate;
133
    }
134
135
    /**
136 1
     * @param bool $hasCustomCertificate
137
     *
138 1
     * @return void
139 1
     */
140
    public function setHasCustomCertificate($hasCustomCertificate)
141
    {
142
        $this->hasCustomCertificate = $hasCustomCertificate;
143
    }
144 1
145
    /**
146 1
     * @param string $ipAddress
147 1
     *
148
     * @return void
149
     */
150
    public function setIpAddress($ipAddress)
151
    {
152 1
        $this->ipAddress = $ipAddress;
153
    }
154 1
155
    /**
156
     * @return null|string
157
     */
158
    public function getIpAddress()
159
    {
160 1
        return $this->ipAddress;
161
    }
162 1
163
    /**
164
     * @return int
165
     */
166
    public function getPendingUpdateCount()
167
    {
168 1
        return $this->pendingUpdateCount;
169
    }
170 1
171 1
    /**
172
     * @param int $pendingUpdateCount
173
     *
174
     * @return void
175
     */
176 1
    public function setPendingUpdateCount($pendingUpdateCount)
177
    {
178 1
        $this->pendingUpdateCount = $pendingUpdateCount;
179
    }
180
181
    /**
182
     * @return int|null
183
     */
184
    public function getLastErrorDate()
185
    {
186
        return $this->lastErrorDate;
187
    }
188
189
    /**
190
     * @param int $lastErrorDate
191
     *
192 1
     * @return void
193
     */
194 1
    public function setLastErrorDate($lastErrorDate)
195
    {
196
        $this->lastErrorDate = $lastErrorDate;
197
    }
198
199
    /**
200
     * @return null|string
201
     */
202
    public function getLastErrorMessage()
203
    {
204
        return $this->lastErrorMessage;
205
    }
206
207
    /**
208
     * @param string $lastErrorMessage
209
     *
210
     * @return void
211
     */
212
    public function setLastErrorMessage($lastErrorMessage)
213
    {
214
        $this->lastErrorMessage = $lastErrorMessage;
215
    }
216 1
217
    /**
218 1
     * @param int $lastSynchronizationErrorDate
219
     *
220
     * @return void
221
     */
222
    public function setLastSynchronizationErrorDate($lastSynchronizationErrorDate)
223
    {
224 1
        $this->lastSynchronizationErrorDate = $lastSynchronizationErrorDate;
225
    }
226 1
227
    /**
228
     * @return int|null
229
     */
230
    public function getLastSynchronizationErrorDate()
231
    {
232 1
        return $this->lastSynchronizationErrorDate;
233
    }
234 1
235 1
    /**
236
     * @return int|null
237
     */
238
    public function getMaxConnections()
239
    {
240 1
        return $this->maxConnections;
241
    }
242 1
243
    /**
244
     * @param int $maxConnections
245
     *
246
     * @return void
247
     */
248
    public function setMaxConnections($maxConnections)
249
    {
250
        $this->maxConnections = $maxConnections;
251
    }
252
253
    /**
254
     * @return array|null
255
     */
256
    public function getAllowedUpdates()
257
    {
258
        return $this->allowedUpdates;
259
    }
260
261
    /**
262
     * @param array $allowedUpdates
263
     *
264
     * @return void
265
     */
266
    public function setAllowedUpdates($allowedUpdates)
267
    {
268
        $this->allowedUpdates = $allowedUpdates;
269
    }
270
}
271