Commit 871e8f54 authored by Jack'lul's avatar Jack'lul

quick fix

parent ebfd9b06
...@@ -18,23 +18,22 @@ class MessageEntity extends Entity ...@@ -18,23 +18,22 @@ class MessageEntity extends Entity
protected $url; protected $url;
/** /**
* @todo check for value from this list: https://core.telegram.org/bots/api#messageentity * @todo check for type value from this list: https://core.telegram.org/bots/api#messageentity
* @todo "empty($this->offset) && $this->offset != 0" - not an ideal solution?
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {
$this->type = isset($data['type']) ? $data['type'] : null; $this->type = isset($data['type']) ? $data['type'] : null;
if (empty($this->type)) { // if (empty($this->type)) {
throw new TelegramException('type is empty!'); throw new TelegramException('type is empty!');
} }
$this->offset = isset($data['offset']) ? $data['offset'] : null; $this->offset = isset($data['offset']) ? $data['offset'] : null;
if (empty($this->offset) && $this->offset != 0) { // if ($this->offset === '') {
throw new TelegramException('offset is empty!'); throw new TelegramException('offset is empty!');
} }
$this->length = isset($data['length']) ? $data['length'] : null; $this->length = isset($data['length']) ? $data['length'] : null;
if (empty($this->length) && $this->offset != 0) { // if ($this->length === '') {
throw new TelegramException('length is empty!'); throw new TelegramException('length is empty!');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment