| 1 | <?php |
||
| 5 | trait Chat { |
||
| 6 | |||
| 7 | /** |
||
| 8 | * \addtogroup Api Api Methods |
||
| 9 | * @{ |
||
| 10 | */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * \brief A simple method for testing your bot's auth token. |
||
| 14 | * \details Requires no parameters. Returns basic information about the bot in form of a User object. [Api reference](https://core.telegram.org/bots/api#getme) |
||
| 15 | */ |
||
| 16 | public function getMe() { |
||
| 21 | |||
| 22 | /** |
||
| 23 | * \brief Get info about a chat. |
||
| 24 | * \details Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). [Api reference](https://core.telegram.org/bots/api#getchat) |
||
| 25 | * @param Unique identifier for the target chat or username of the target supergroup or channel (in the format <code>@channelusername</code>) |
||
| 26 | */ |
||
| 27 | public function getChat($_chat_id) { |
||
| 36 | |||
| 37 | /** |
||
| 38 | * \brief Use this method to get a list of administrators in a chat. |
||
| 39 | * @param Unique identifier for the target chat or username of the target supergroup or channel (in the format <code>@channelusername</code>) |
||
| 40 | * @return On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. |
||
| 41 | */ |
||
| 42 | public function getChatAdministrators($_chat_id) { |
||
| 51 | |||
| 52 | /** @} */ |
||
| 53 | |||
| 54 | } |
||
| 55 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.