Updated PhotoSize

This commit is contained in:
netkas 2024-10-05 00:36:00 -04:00
parent 0a91098f98
commit b19ed2f36d

View file

@ -7,30 +7,11 @@
class PhotoSize implements ObjectTypeInterface
{
/**
* @var string
*/
private $file_id;
/**
* @var string
*/
private $file_unique_id;
/**
* @var string
*/
private $width;
/**
* @var string
*/
private $height;
/**
* @var int|null
*/
private $file_size;
private string $file_id;
private string $file_unique_id;
private string $width;
private string $height;
private ?int $file_size;
/**
* Identifier for this file, which can be used to download or reuse the file
@ -85,9 +66,7 @@
}
/**
* Returns an array representation of the object
*
* @return array
* @inheritDoc
*/
public function toArray(): array
{
@ -101,16 +80,16 @@
}
/**
* Constructs an object from an array representation
*
* @param array $data
* @return PhotoSize
* @noinspection DuplicatedCode
* @inheritDoc
*/
public static function fromArray(array $data): self
public static function fromArray(?array $data): ?PhotoSize
{
$object = new self();
if($data === null)
{
return null;
}
$object = new self();
$object->file_id = $data['file_id'] ?? null;
$object->file_unique_id = $data['file_unique_id'] ?? null;
$object->width = $data['width'] ?? null;