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 * @inheritDoc
*
* @return array
*/ */
public function toArray(): array public function toArray(): array
{ {
@ -171,15 +169,16 @@
} }
/** /**
* Constructs an object from an array representation * @inheritDoc
*
* @param array $data
* @return static
*/ */
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->id = $data['id'] ?? null;
$object->is_bot = $data['is_bot'] ?? false; $object->is_bot = $data['is_bot'] ?? false;
$object->first_name = $data['first_name'] ?? null; $object->first_name = $data['first_name'] ?? null;