Thanks to this class:
https://github.com/WebPajooh/TeleBot/blob/master/src/InlineKeyboard.php
I can build keyboards step by step:
$keyboard = new InlineKeyboard()
->addCallbackButton('Start', 'start_callback')
->addCallbackButton('Help', 'help_callback')
->addUrlButton('FAQ', 'https://example.com/faq')
->get();
The output of get()
method is an object encoded by json_encode()
.
My question is:
- Can we consider this class a builder?
- If answer is no, why?
- Its output is not an object, but a string; does it mean that it is not implementing builder pattern?
Aucun commentaire:
Enregistrer un commentaire