Updated Video
This commit is contained in:
parent
38657c128d
commit
60d2f1b9fd
1 changed files with 19 additions and 55 deletions
|
@ -6,50 +6,15 @@
|
|||
|
||||
class Video implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $file_id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $file_unique_id;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $width;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $height;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $duration;
|
||||
|
||||
/**
|
||||
* @var PhotoSize|null
|
||||
*/
|
||||
private $thumbnail;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $file_name;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $mime_type;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $file_size;
|
||||
private string $file_id;
|
||||
private string $file_unique_id;
|
||||
private int $width;
|
||||
private int $height;
|
||||
private int $duration;
|
||||
private ?PhotoSize $thumbnail;
|
||||
private ?string $file_name;
|
||||
private ?string $mime_type;
|
||||
private ?int $file_size;
|
||||
|
||||
/**
|
||||
* Identifier for this file, which can be used to download or reuse the file
|
||||
|
@ -145,9 +110,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object.
|
||||
*
|
||||
* @return array
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
|
@ -157,7 +120,7 @@
|
|||
'width' => $this->width,
|
||||
'height' => $this->height,
|
||||
'duration' => $this->duration,
|
||||
'thumbnail' => ($this->thumbnail instanceof ObjectTypeInterface) ? $this->thumbnail->toArray() : null,
|
||||
'thumbnail' => $this->thumbnail?->toArray(),
|
||||
'file_name' => $this->file_name ?? null,
|
||||
'mime_type' => $this->mime_type ?? null,
|
||||
'file_size' => $this->file_size ?? null,
|
||||
|
@ -165,21 +128,22 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs the object from an array representation.
|
||||
*
|
||||
* @param array $data
|
||||
* @return Video
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): self
|
||||
public static function fromArray(?array $data): ?Video
|
||||
{
|
||||
$object = new self();
|
||||
if($data === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$object = new self();
|
||||
$object->file_id = $data['file_id'];
|
||||
$object->file_unique_id = $data['file_unique_id'];
|
||||
$object->width = $data['width'];
|
||||
$object->height = $data['height'];
|
||||
$object->duration = $data['duration'];
|
||||
$object->thumbnail = (isset($data['thumbnail'])) ? PhotoSize::fromArray($data['thumbnail']) : null;
|
||||
$object->thumbnail = isset($data['thumbnail']) ? PhotoSize::fromArray($data['thumbnail']) : null;
|
||||
$object->file_name = $data['file_name'] ?? null;
|
||||
$object->mime_type = $data['mime_type'] ?? null;
|
||||
$object->file_size = $data['file_size'] ?? null;
|
||||
|
|
Loading…
Add table
Reference in a new issue