Updated File

This commit is contained in:
netkas 2024-10-04 21:09:36 -04:00
parent c546a44b78
commit e12979d7af

View file

@ -7,25 +7,10 @@
class File implements ObjectTypeInterface
{
/**
* @var string
*/
private $file_id;
/**
* @var string
*/
private $file_unique_id;
/**
* @var int|null
*/
private $file_size;
/**
* @var string|null
*/
private $file_path;
private string $file_id;
private string $file_unique_id;
private ?int $file_size;
private ?string $file_path;
/**
* Identifier for this file, which can be used to download or reuse the file
@ -71,9 +56,7 @@
}
/**
* Returns an array representation of the object
*
* @return array
* @inheritDoc
*/
public function toArray(): array
{
@ -86,18 +69,21 @@
}
/**
* Constructs object from an array representation
*
* @param array $data
* @return File
* @inheritDoc
*/
public static function fromArray(array $data): File
public static function fromArray(?array $data): ?File
{
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->file_size = $data['file_size'] ?? null;
$object->file_path = $data['file_path'] ?? null;
return $object;
}
}