@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace PhpBotFramework; |
| 4 | 4 | |
| 5 | -use PhpBotFramework\Exceptions\BotException; |
|
| 6 | - |
|
| 7 | 5 | use PhpBotFramework\Entities\InlineKeyboard; |
| 8 | 6 | |
| 9 | 7 | class Bot extends Core\BaseBot { |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * \brief (<i>Internal</i>) Process the callback query and check if it triggers a command of this type. |
| 37 | 37 | * @param $callback_query Callback query to process. |
| 38 | - * @return True if the callback query triggered a command. |
|
| 38 | + * @return boolean if the callback query triggered a command. |
|
| 39 | 39 | */ |
| 40 | 40 | protected function processCallbackCommand(array $callback_query) : bool { |
| 41 | 41 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | /** |
| 38 | 38 | * \brief (<i>Internal</i>)Process a message checking if it trigger any MessageCommand. |
| 39 | 39 | * @param $message Message to process. |
| 40 | - * @return True if the message triggered any command. |
|
| 40 | + * @return boolean if the message triggered any command. |
|
| 41 | 41 | */ |
| 42 | 42 | protected function processMessageCommand(array $message) : bool { |
| 43 | 43 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | /** |
| 37 | 37 | * \brief (<i>Internal</i>) Process the message to check if it triggers a command of this type. |
| 38 | 38 | * @param $message Message to process. |
| 39 | - * @return True if the message triggered a command. |
|
| 39 | + * @return boolean if the message triggered a command. |
|
| 40 | 40 | */ |
| 41 | 41 | protected function processMessageRegexCommand(array $message) : bool { |
| 42 | 42 | |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | * \brief Dispatch each update to the right method (processMessage, processCallbackQuery, etc). |
| 149 | 149 | * \details Set $chat_id for each update, $text, $data and $query are set for each update that contains them. |
| 150 | 150 | * @param $update Reference to the update received. |
| 151 | - * @return The id of the update processed. |
|
| 151 | + * @return integer id of the update processed. |
|
| 152 | 152 | */ |
| 153 | 153 | protected function processUpdate(array $update) : int { |
| 154 | 154 | |
@@ -385,7 +385,7 @@ |
||
| 385 | 385 | */ |
| 386 | 386 | |
| 387 | 387 | /** \brief Core function to execute url request. |
| 388 | - * @param $url The url to call using the curl session. |
|
| 388 | + * @param string $url The url to call using the curl session. |
|
| 389 | 389 | * @return Url response, false on error. |
| 390 | 390 | */ |
| 391 | 391 | protected function exec_curl_request($url, $method = 'POST') { |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /** \brief Add a user to the database. |
| 20 | 20 | * \details Add a user to the database in Bot::$user_table table and Bot::$id_column column using Bot::$pdo connection. |
| 21 | 21 | * @param $chat_id chat_id of the user to add. |
| 22 | - * @return True on success. |
|
| 22 | + * @return boolean on success. |
|
| 23 | 23 | */ |
| 24 | 24 | public function addUser($chat_id) : bool { |
| 25 | 25 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * \brief (<i>Internal</i>)Get first update offset in redis. |
| 15 | 15 | * \details Called by getUpdatesRedis to get the offset saved in redis or to get it from telegram and save it in redis. |
| 16 | 16 | * @param $offset_key Name of the variable where the offset is saved on Redis |
| 17 | - * @return Id of the first update to process. |
|
| 17 | + * @return integer of the first update to process. |
|
| 18 | 18 | */ |
| 19 | 19 | protected function getUpdateOffsetRedis(string $offset_key) : int { |
| 20 | 20 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * \details Called by getUpdatesDatabase to get the offset saved in database or to get it from telegram and save it in database. |
| 103 | 103 | * @param $table_name Name of the table where offset is saved in the database |
| 104 | 104 | * @param $column_name Name of the column where the offset is saved in the database |
| 105 | - * @return Id of the first update to process. |
|
| 105 | + * @return integer of the first update to process. |
|
| 106 | 106 | */ |
| 107 | 107 | protected function getUpdateOffsetDatabase(string $table_name, string $column_name) : int { |
| 108 | 108 | |
@@ -5,15 +5,15 @@ |
||
| 5 | 5 | // Use to sort _command_types based on prior |
| 6 | 6 | function sortingPrior($a, $b) { |
| 7 | 7 | |
| 8 | - if($a['prior'] > $b['prior']) |
|
| 8 | + if ($a['prior'] > $b['prior']) |
|
| 9 | 9 | |
| 10 | 10 | return 1; |
| 11 | 11 | |
| 12 | - if($a['prior'] < $b['prior']) |
|
| 12 | + if ($a['prior'] < $b['prior']) |
|
| 13 | 13 | |
| 14 | 14 | return -1; |
| 15 | 15 | |
| 16 | - if($a['prior'] == $b['prior']) |
|
| 16 | + if ($a['prior'] == $b['prior']) |
|
| 17 | 17 | |
| 18 | 18 | return 0; |
| 19 | 19 | |
@@ -5,17 +5,20 @@ |
||
| 5 | 5 | // Use to sort _command_types based on prior |
| 6 | 6 | function sortingPrior($a, $b) { |
| 7 | 7 | |
| 8 | - if($a['prior'] > $b['prior']) |
|
| 9 | - |
|
| 8 | + if($a['prior'] > $b['prior']) { |
|
| 9 | + |
|
| 10 | 10 | return 1; |
| 11 | + } |
|
| 11 | 12 | |
| 12 | - if($a['prior'] < $b['prior']) |
|
| 13 | - |
|
| 13 | + if($a['prior'] < $b['prior']) { |
|
| 14 | + |
|
| 14 | 15 | return -1; |
| 16 | + } |
|
| 15 | 17 | |
| 16 | - if($a['prior'] == $b['prior']) |
|
| 17 | - |
|
| 18 | + if($a['prior'] == $b['prior']) { |
|
| 19 | + |
|
| 18 | 20 | return 0; |
| 21 | + } |
|
| 19 | 22 | |
| 20 | 23 | } |
| 21 | 24 | |