In the class BotApi, the constants URL_PREFIX and FILE_URL_PREFIX are used through self:: in the constructor:
const URL_PREFIX = 'https://api.telegram.org/bot';
const FILE_URL_PREFIX = 'https://api.telegram.org/file/bot';
public function __construct($token, ?HttpClientInterface $httpClient = null, $endpoint = null)
{
$this->token = $token;
$this->endpoint = ($endpoint ?: self::URL_PREFIX) . $token;
$this->fileEndpoint = $endpoint ? null : (self::FILE_URL_PREFIX . $token);
$this->httpClient = $httpClient ?: new CurlHttpClient();
}
If I want to create a custom src/Client that will use a custom src/BotApi with redefined constants, then the redefinition doesn't work.
I believe that replacing self with static should solve the problem.
If you use the third parameter $endpoint to request your local server, you will still use requests to 'https://api.telegram.org/bot'.
In the class
BotApi, the constantsURL_PREFIXandFILE_URL_PREFIXare used throughself::in the constructor:If I want to create a custom src/Client that will use a custom src/BotApi with redefined constants, then the redefinition doesn't work.
I believe that replacing self with static should solve the problem.
If you use the third parameter $endpoint to request your local server, you will still use requests to 'https://api.telegram.org/bot'.