Commit f92f78e5 authored by Armando Lüscher's avatar Armando Lüscher Committed by GitHub

Merge pull request #248 from MBoretto/durationfix

allow value 0 for duration
parents 98f13b08 281f39e1
...@@ -34,7 +34,7 @@ class Audio extends Entity ...@@ -34,7 +34,7 @@ class Audio extends Entity
} }
$this->duration = isset($data['duration']) ? $data['duration'] : null; $this->duration = isset($data['duration']) ? $data['duration'] : null;
if (empty($this->duration)) { if ($this->duration === '' || $this->duration === null) {
throw new TelegramException('duration is empty!'); throw new TelegramException('duration is empty!');
} }
......
...@@ -45,7 +45,7 @@ class Video extends Entity ...@@ -45,7 +45,7 @@ class Video extends Entity
throw new TelegramException('height is empty!'); throw new TelegramException('height is empty!');
} }
$this->duration = isset($data['duration']) ? $data['duration'] : null; $this->duration = isset($data['duration']) ? $data['duration'] : null;
if (empty($this->duration)) { if ($this->duration === '' || $this->duration === null) {
throw new TelegramException('duration is empty!'); throw new TelegramException('duration is empty!');
} }
$this->thumb = isset($data['thumb']) ? $data['thumb'] : null; $this->thumb = isset($data['thumb']) ? $data['thumb'] : null;
......
...@@ -32,7 +32,7 @@ class Voice extends Entity ...@@ -32,7 +32,7 @@ class Voice extends Entity
} }
$this->duration = isset($data['duration']) ? $data['duration'] : null; $this->duration = isset($data['duration']) ? $data['duration'] : null;
if (empty($this->duration)) { if ($this->duration === '' || $this->duration === null) {
throw new TelegramException('duration is empty!'); throw new TelegramException('duration 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