diff --git a/src/TgBotLib/Objects/ChatLocation.php b/src/TgBotLib/Objects/ChatLocation.php new file mode 100644 index 0000000..3309586 --- /dev/null +++ b/src/TgBotLib/Objects/ChatLocation.php @@ -0,0 +1,69 @@ +location; + } + + /** + * Location address; 1-64 characters, as defined by the chat owner + * + * @return string + */ + public function getAddress(): string + { + return $this->address; + } + + /** + * Returns an array representation of the object + * + * @return array + */ + public function toArray(): array + { + return [ + 'location' => ($this->location instanceof Location) ? $this->location->toArray() : $this->location, + 'address' => $this->address, + ]; + } + + /** + * Constructs object from an array representation + * + * @param array $data + * @return ObjectTypeInterface + */ + public static function fromArray(array $data): ObjectTypeInterface + { + $object = new self(); + + $object->location = isset($data['location']) ? Location::fromArray($data['location']) : null; + $object->address = isset($data['address']) ? $data['address'] : null; + + return $object; + } + } \ No newline at end of file