Updated ChatLocation
This commit is contained in:
parent
741356c5b5
commit
7b54b8572d
1 changed files with 6 additions and 19 deletions
|
@ -7,15 +7,8 @@
|
|||
|
||||
class ChatLocation implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var Location
|
||||
*/
|
||||
private $location;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $address;
|
||||
private Location $location;
|
||||
private string $address;
|
||||
|
||||
/**
|
||||
* The location to which the supergroup is connected. Can't be a live location.
|
||||
|
@ -38,28 +31,22 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'location' => ($this->location instanceof ObjectTypeInterface) ? $this->location->toArray() : $this->location,
|
||||
'location' => $this->location?->toArray(),
|
||||
'address' => $this->address,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from an array representation
|
||||
*
|
||||
* @param array $data
|
||||
* @return ChatLocation
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): self
|
||||
public static function fromArray(?array $data): ChatLocation
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->location = isset($data['location']) ? Location::fromArray($data['location']) : null;
|
||||
$object->address = $data['address'] ?? null;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue