Updated User
This commit is contained in:
parent
a54ad4bf1e
commit
f2dbe173b5
1 changed files with 8 additions and 9 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue