Instead of adding all the specific entity variables and methods, it would make sense to have a base class with a magic __call() method that handles all requests.
Check this example from the other PHP Telegram library.
It would save a whole bunch of code and clean up effort, making it a lot more understandable and easier to test / maintain etc.
DRY = Don't Repeat Yourself
I've also noticed that objects which contain another object (InlineKeyboardMarkup + InlineKeyboardButton) contain bot_name field, which is useless to send to Telegram API. (cause is in Entity.php).
@Jacklul bot name is not sent to telegram because is filtered during serialization. Private Member of objects are not serialized see entity.php function tojson.
@MBoretto True, but still it shouldn't be there 馃槈
We can move the bot_name just in telegram.php everyone agree? Basically is used in message.php to match botname from commands in a group chat
I was thinking to create a static member bot_name in the Telegram object in order to retrieve the bot_name where is needed (for example in message entities) with something like:
$bot_name = Telegram::getBotName();
@jacklul @noplanman what do you think?
This library is getting more and more static, is that something we should encourage?
Making things static, as you suggest above, obviously makes it easier to access data from anywhere, but at the same time it allows only a single instance of the Telegram object.
I'm really not sure what position I take on this 馃槙
@jacklul ?
While in https://github.com/akalongman/php-telegram-bot/issues/193#issuecomment-230376104 it might actually become useful I'm against making library THAT MUCH static based.
Developers will probably code their own classes on static functions (like I do) because it's easier to use later,
The main part of this issue is fixed in #291
Issue regarding static $bot_name is being discussed here: #337