Updated Story

This commit is contained in:
netkas 2024-10-05 00:55:14 -04:00
parent e246741b5a
commit af7a33b1c1

View file

@ -1,11 +1,11 @@
<?php
namespace TgBotLib\Objects;
namespace TgBotLib\Objects;
use TgBotLib\Interfaces\ObjectTypeInterface;
use TgBotLib\Interfaces\ObjectTypeInterface;
class Story implements ObjectTypeInterface
{
class Story implements ObjectTypeInterface
{
private string $file_id;
private string $file_unique_id;
private int $width;
@ -120,7 +120,7 @@ class Story implements ObjectTypeInterface
'width' => $this->width,
'height' => $this->height,
'duration' => $this->duration,
'thumbnail' => $this->thumbnail ? $this->thumbnail->toArray() : null,
'thumbnail' => $this->thumbnail?->toArray(),
'file_name' => $this->file_name,
'mime_type' => $this->mime_type,
'file_size' => $this->file_size,
@ -130,10 +130,14 @@ class Story implements ObjectTypeInterface
/**
* @inheritDoc
*/
public static function fromArray(array $data): ObjectTypeInterface
public static function fromArray(?array $data): ?Story
{
$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'];
@ -146,4 +150,4 @@ class Story implements ObjectTypeInterface
return $object;
}
}
}