for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class Audio extends Entity
{
* @var mixed|null
protected $file_id;
protected $duration;
protected $performer;
protected $title;
protected $mime_type;
protected $file_size;
* Audio constructor.
* @param array $data
* @throws \Longman\TelegramBot\Exception\TelegramException
public function __construct(array $data)
$this->file_id = isset($data['file_id']) ? $data['file_id'] : null;
if (empty($this->file_id)) {
throw new TelegramException('file_id is empty!');
}
$this->duration = isset($data['duration']) ? $data['duration'] : null;
if ($this->duration === '' || $this->duration === null) {
throw new TelegramException('duration is empty!');
$this->performer = isset($data['performer']) ? $data['performer'] : null;
$this->title = isset($data['title']) ? $data['title'] : null;
$this->mime_type = isset($data['mime_type']) ? $data['mime_type'] : null;
$this->file_size = isset($data['file_size']) ? $data['file_size'] : null;
* Get file id
* @return mixed|null
public function getFileId()
return $this->file_id;
* Get duration
public function getDuration()
return $this->duration;
* Get performer
public function getPerformer()
return $this->performer;
* Get title
public function getTitle()
return $this->title;
* Get mime type
public function getMimeType()
return $this->mime_type;
* Get file size
public function getFileSize()
return $this->file_size;