Added \TgBotLib\Objects > WebAppInfo
This commit is contained in:
parent
dc5e194adf
commit
019afe6c8f
1 changed files with 49 additions and 0 deletions
49
src/TgBotLib/Objects/WebAppInfo.php
Normal file
49
src/TgBotLib/Objects/WebAppInfo.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue