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
|
* @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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue