for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Greenplugin\TelegramBot\Method;
use Greenplugin\TelegramBot\Method\Interfaces\HasParseModeVariableInterface;
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
use Greenplugin\TelegramBot\Method\Traits\SendToChatVariablesTrait;
/**
* Class SendMessageMethod.
*
* @see https://core.telegram.org/bots/api#sendmessage
*/
class SendMessageMethod implements HasParseModeVariableInterface
{
use FillFromArrayTrait;
use SendToChatVariablesTrait;
* Text of the message to be sent.
* @var string
public $text;
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width
* text or inline URLs in the media caption.
* @var string|null
public $parseMode;
* Optional. Disables link previews for links in this message.
* @var bool|null
public $disableWebPagePreview;
* @param int|string $chatId
* @param string $text
* @param array|null $data
* @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
* @return SendMessageMethod
public static function create($chatId, string $text, array $data = null): SendMessageMethod
$instance = new static();
$instance->chatId = $chatId;
$instance->text = $text;
if ($data) {
$instance->fill($data);
}
return $instance;