Added \TgBotLib\Objects > WebAppInfo

This commit is contained in:
Netkas 2023-02-12 22:40:33 -05:00
parent dc5e194adf
commit 019afe6c8f

View file

@ -0,0 +1,49 @@
<?php
namespace TgBotLib\Objects;
use TgBotLib\Interfaces\ObjectTypeInterface;
class WebAppInfo implements ObjectTypeInterface
{
/**
* @var string
*/
private $url;
/**
* An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps
*
* @see https://core.telegram.org/bots/webapps#initializing-web-apps
* @return string
*/
public function getUrl(): string
{
return $this->url;
}
/**
* Returns an array representation of the object.
*
* @return array
*/
public function toArray(): array
{
return [
'url' => $this->url,
];
}
/**
* Constructs the object from an array representation.
*
* @param array $data
* @return ObjectTypeInterface
*/
public static function fromArray(array $data): ObjectTypeInterface
{
$object = new self();
$object->url = $data['url'];
return $object;
}
}