Updated User

This commit is contained in:
netkas 2024-10-06 15:53:35 -04:00
parent a54ad4bf1e
commit f2dbe173b5

View file

@ -147,9 +147,7 @@
/**
* Returns an array representation of the object
*
* @return array
* @inheritDoc
*/
public function toArray(): array
{
@ -171,15 +169,16 @@
}
/**
* Constructs an object from an array representation
*
* @param array $data
* @return static
* @inheritDoc
*/
public static function fromArray(array $data): self
public static function fromArray(?array $data): ?User
{
$object = new self();
if($data === null)
{
return null;
}
$object = new self();
$object->id = $data['id'] ?? null;
$object->is_bot = $data['is_bot'] ?? false;
$object->first_name = $data['first_name'] ?? null;