Longman\TelegramBot\Request::send PHP Method

send() public static method

Send command
public static send ( string $action, array $data = [] ) : ServerResponse
$action string
$data array
return Longman\TelegramBot\Entities\ServerResponse
    public static function send($action, array $data = [])
    {
        self::ensureValidAction($action);
        $bot_name = self::$telegram->getBotName();
        if (defined('PHPUNIT_TESTSUITE')) {
            $fake_response = self::generateGeneralFakeServerResponse($data);
            return new ServerResponse($fake_response, $bot_name);
        }
        self::ensureNonEmptyData($data);
        $response = json_decode(self::execute($action, $data), true);
        if (null === $response) {
            throw new TelegramException('Telegram returned an invalid response! Please review your bot name and API key.');
        }
        return new ServerResponse($response, $bot_name);
    }