Skip to content

Commit 61d6c75

Browse files
committed
Merge pull request php-telegram-bot#190 from jacklul/fix
Quick Fix
2 parents ebfd9b0 + 871e8f5 commit 61d6c75

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Entities/MessageEntity.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,22 @@ class MessageEntity extends Entity
1818
protected $url;
1919

2020
/**
21-
* @todo check for value from this list: https://core.telegram.org/bots/api#messageentity
22-
* @todo "empty($this->offset) && $this->offset != 0" - not an ideal solution?
21+
* @todo check for type value from this list: https://core.telegram.org/bots/api#messageentity
2322
*/
2423
public function __construct(array $data)
2524
{
2625
$this->type = isset($data['type']) ? $data['type'] : null;
27-
if (empty($this->type)) { //
26+
if (empty($this->type)) {
2827
throw new TelegramException('type is empty!');
2928
}
3029

3130
$this->offset = isset($data['offset']) ? $data['offset'] : null;
32-
if (empty($this->offset) && $this->offset != 0) { //
31+
if ($this->offset === '') {
3332
throw new TelegramException('offset is empty!');
3433
}
3534

3635
$this->length = isset($data['length']) ? $data['length'] : null;
37-
if (empty($this->length) && $this->offset != 0) { //
36+
if ($this->length === '') {
3837
throw new TelegramException('length is empty!');
3938
}
4039

0 commit comments

Comments
 (0)