Minor Correction

This commit is contained in:
netkas 2024-10-06 18:50:26 -04:00
parent 220100c4b5
commit 5703ce9987
5 changed files with 163 additions and 163 deletions

View file

@ -1,30 +1,30 @@
<?php
namespace TgBotLib\Methods;
namespace TgBotLib\Methods;
use InvalidArgumentException;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Objects\Message;
use InvalidArgumentException;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Objects\Message;
class SendMessage extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): Message
class SendMessage extends Method
{
if(!isset($parameters['chat_id']))
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): Message
{
throw new InvalidArgumentException('chat_id is required');
}
if(!isset($parameters['chat_id']))
{
throw new InvalidArgumentException('chat_id is required');
}
if(!isset($parameters['text']))
{
throw new InvalidArgumentException('text is required');
}
if(!isset($parameters['text']))
{
throw new InvalidArgumentException('text is required');
}
return Message::fromArray(self::executeCurl(self::buildPost($bot, Methods::SEND_MESSAGE->value, $parameters)));
}
}
return Message::fromArray(self::executeCurl(self::buildPost($bot, Methods::SEND_MESSAGE->value, $parameters)));
}
}