Updated File
This commit is contained in:
parent
c546a44b78
commit
e12979d7af
1 changed files with 13 additions and 27 deletions
|
@ -7,25 +7,10 @@
|
||||||
|
|
||||||
class File implements ObjectTypeInterface
|
class File implements ObjectTypeInterface
|
||||||
{
|
{
|
||||||
/**
|
private string $file_id;
|
||||||
* @var string
|
private string $file_unique_id;
|
||||||
*/
|
private ?int $file_size;
|
||||||
private $file_id;
|
private ?string $file_path;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $file_unique_id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int|null
|
|
||||||
*/
|
|
||||||
private $file_size;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string|null
|
|
||||||
*/
|
|
||||||
private $file_path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier for this file, which can be used to download or reuse the file
|
* 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
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
|
@ -86,18 +69,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs object from an array representation
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @return File
|
|
||||||
*/
|
*/
|
||||||
public static function fromArray(array $data): File
|
public static function fromArray(?array $data): ?File
|
||||||
{
|
{
|
||||||
|
if($data === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$object = new self();
|
$object = new self();
|
||||||
$object->file_id = $data['file_id'] ?? null;
|
$object->file_id = $data['file_id'] ?? null;
|
||||||
$object->file_unique_id = $data['file_unique_id'] ?? null;
|
$object->file_unique_id = $data['file_unique_id'] ?? null;
|
||||||
$object->file_size = $data['file_size'] ?? null;
|
$object->file_size = $data['file_size'] ?? null;
|
||||||
$object->file_path = $data['file_path'] ?? null;
|
$object->file_path = $data['file_path'] ?? null;
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue