@@ -100,7 +100,7 @@ |
||
| 100 | 100 | |
| 101 | 101 | // Exec getUpdates |
| 102 | 102 | $this->execRequest('getUpdates?' . http_build_query($parameters) |
| 103 | - . '&allowed_updates=' . json_encode($allowed_updates)); |
|
| 103 | + . '&allowed_updates=' . json_encode($allowed_updates)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** @} */ |
@@ -18,8 +18,6 @@ |
||
| 18 | 18 | |
| 19 | 19 | namespace PhpBotFramework\Test; |
| 20 | 20 | |
| 21 | -use PhpBotFramework\Entities\Message; |
|
| 22 | - |
|
| 23 | 21 | /* \class FakeUpdate |
| 24 | 22 | * \brief Contains abstract methods for processing fake updates. |
| 25 | 23 | */ |
@@ -19,9 +19,7 @@ |
||
| 19 | 19 | namespace PhpBotFramework\Core; |
| 20 | 20 | |
| 21 | 21 | use PhpBotFramework\Exceptions\BotException; |
| 22 | - |
|
| 23 | 22 | use PhpBotFramework\Entities\File as TelegramFile; |
| 24 | - |
|
| 25 | 23 | use PhpBotFramework\Entities\InlineKeyboard; |
| 26 | 24 | |
| 27 | 25 | /** |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | /** |
| 392 | 392 | * \brief Set current chat ID. |
| 393 | 393 | * \details Change the chat ID on which the bot acts. |
| 394 | - * @param $chat_id The new chat ID to set. |
|
| 394 | + * @param string $chat_id The new chat ID to set. |
|
| 395 | 395 | */ |
| 396 | 396 | public function setChatID($chat_id) |
| 397 | 397 | { |
@@ -447,7 +447,6 @@ discard block |
||
| 447 | 447 | * brief Process an API method by taking method and parameter. |
| 448 | 448 | * \details optionally create a object of $class class name with the response as constructor param. |
| 449 | 449 | * @param string $method Method to call. |
| 450 | - * @param array $param Parameter for the method. |
|
| 451 | 450 | * @param string $class Class name of the object to create using response. |
| 452 | 451 | * @return mixed Response or object of $class class name. |
| 453 | 452 | */ |
@@ -525,6 +524,9 @@ discard block |
||
| 525 | 524 | return $this->checkRequestError($response); |
| 526 | 525 | } |
| 527 | 526 | |
| 527 | + /** |
|
| 528 | + * @param \Psr\Http\Message\ResponseInterface $response |
|
| 529 | + */ |
|
| 528 | 530 | public function checkRequestError($response) |
| 529 | 531 | { |
| 530 | 532 | $http_code = $response->getStatusCode(); |
@@ -324,27 +324,27 @@ |
||
| 324 | 324 | Chat; |
| 325 | 325 | |
| 326 | 326 | /** @internal |
| 327 | - * \brief Chat_id of the user that interacted with the bot. */ |
|
| 327 | + * \brief Chat_id of the user that interacted with the bot. */ |
|
| 328 | 328 | protected $_chat_id; |
| 329 | 329 | |
| 330 | 330 | /** @internal |
| 331 | - * \brief Bot id. */ |
|
| 331 | + * \brief Bot id. */ |
|
| 332 | 332 | protected $_bot_id; |
| 333 | 333 | |
| 334 | 334 | /** @internal |
| 335 | - * \brief API endpoint (containing $token). */ |
|
| 335 | + * \brief API endpoint (containing $token). */ |
|
| 336 | 336 | protected $_api_url; |
| 337 | 337 | |
| 338 | 338 | /** @internal |
| 339 | - * \brief Implements interface for execute HTTP requests. */ |
|
| 339 | + * \brief Implements interface for execute HTTP requests. */ |
|
| 340 | 340 | protected $_http; |
| 341 | 341 | |
| 342 | 342 | /** @internal |
| 343 | - * \brief Object of class PhpBotFramework\Entities\File that contain a path or resource to a file that has to be sent using Telegram API Methods. */ |
|
| 343 | + * \brief Object of class PhpBotFramework\Entities\File that contain a path or resource to a file that has to be sent using Telegram API Methods. */ |
|
| 344 | 344 | protected $_file; |
| 345 | 345 | |
| 346 | 346 | /** \@internal |
| 347 | - * brief Contains parameters of the next request. */ |
|
| 347 | + * brief Contains parameters of the next request. */ |
|
| 348 | 348 | protected $parameters; |
| 349 | 349 | |
| 350 | 350 | /** |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | $offset = $this->getUpdateOffsetRedis($offset_key); |
| 96 | 96 | $this->initCommands(); |
| 97 | 97 | |
| 98 | - // Process all updates received |
|
| 98 | + // Process all updates received |
|
| 99 | 99 | while (true) { |
| 100 | 100 | $updates = $this->getUpdates($offset, $limit, $timeout); |
| 101 | 101 | |
@@ -8,21 +8,21 @@ discard block |
||
| 8 | 8 | require_once '../../vendor/autoload.php'; |
| 9 | 9 | |
| 10 | 10 | class WhoAmIBot extends PhpBotFramework\Bot { |
| 11 | - // Override 'processMessage' in order to intercept the message and |
|
| 12 | - // get information about its author (if forwarded, its original author). |
|
| 13 | - protected function processMessage($message) { |
|
| 11 | + // Override 'processMessage' in order to intercept the message and |
|
| 12 | + // get information about its author (if forwarded, its original author). |
|
| 13 | + protected function processMessage($message) { |
|
| 14 | 14 | // Check if the message was forward |
| 15 | 15 | isset($message['forward_from']) ? $index = 'forward_from' : $index = 'from'; |
| 16 | 16 | |
| 17 | 17 | $response = $this->prepareResponse($message[$index]); |
| 18 | 18 | $this->sendMessage($response); |
| 19 | - } |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - private function prepareResponse($user) { |
|
| 21 | + private function prepareResponse($user) { |
|
| 22 | 22 | return '<strong>Message sent by </strong>' . $user['first_name'] . "\n" . |
| 23 | - '<strong>User ID: </strong>' . $user['id'] . "\n" . |
|
| 24 | - '<strong>Username: </strong>' . $user['username'] . "\n"; |
|
| 25 | - } |
|
| 23 | + '<strong>User ID: </strong>' . $user['id'] . "\n" . |
|
| 24 | + '<strong>Username: </strong>' . $user['username'] . "\n"; |
|
| 25 | + } |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | // Add a welcome message |
| 32 | 32 | $bot->addMessageCommand('start', function ($bot, $message) { |
| 33 | - $bot->sendMessage('<strong>Hey there!</strong> Send or forward me a text message :)'); |
|
| 33 | + $bot->sendMessage('<strong>Hey there!</strong> Send or forward me a text message :)'); |
|
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | 36 | $bot->getUpdatesLocal(); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $bot = new WhoAmIBot('YOUR_BOT_TOKEN'); |
| 30 | 30 | |
| 31 | 31 | // Add a welcome message |
| 32 | -$bot->addMessageCommand('start', function ($bot, $message) { |
|
| 32 | +$bot->addMessageCommand('start', function($bot, $message) { |
|
| 33 | 33 | $bot->sendMessage('<strong>Hey there!</strong> Send or forward me a text message :)'); |
| 34 | 34 | }); |
| 35 | 35 | |
@@ -9,10 +9,10 @@ |
||
| 9 | 9 | require_once '../../vendor/autoload.php'; |
| 10 | 10 | |
| 11 | 11 | class EchoBot extends PhpBotFramework\Bot { |
| 12 | - // Override processMessage in order to send user the same message it give us. |
|
| 13 | - protected function processMessage($message) { |
|
| 12 | + // Override processMessage in order to send user the same message it give us. |
|
| 13 | + protected function processMessage($message) { |
|
| 14 | 14 | $this->sendMessage($message['text']); |
| 15 | - } |
|
| 15 | + } |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | $bot = new EchoBot('YOUR_BOT_TOKEN'); |
@@ -63,6 +63,4 @@ |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // If not return the data from the array after checking it is set |
| 66 | - return isset($this->container[$offset]) ? $this->container[$offset] : null; |
|
| 67 | - } |
|
| 68 | -} |
|
| 66 | + return isset($this->container[$offset]) ? $this->container[$offset |
|
| 69 | 67 | \ No newline at end of file |
@@ -63,6 +63,4 @@ |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // If not return the data from the array after checking it is set |
| 66 | - return isset($this->container[$offset]) ? $this->container[$offset] : null; |
|
| 67 | - } |
|
| 68 | -} |
|
| 66 | + return isset($this->container[$offset]) ? $this->container[$offset |
|
| 69 | 67 | \ No newline at end of file |
@@ -63,6 +63,4 @@ |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // If not return the data from the array after checking it is set |
| 66 | - return isset($this->container[$offset]) ? $this->container[$offset] : null; |
|
| 67 | - } |
|
| 68 | -} |
|
| 66 | + return isset($this->container[$offset]) ? $this->container[$offset |
|
| 69 | 67 | \ No newline at end of file |
@@ -63,6 +63,4 @@ |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // If not return the data from the array after checking it is set |
| 66 | - return isset($this->container[$offset]) ? $this->container[$offset] : null; |
|
| 67 | - } |
|
| 68 | -} |
|
| 66 | + return isset($this->container[$offset]) ? $this->container[$offset |
|
| 69 | 67 | \ No newline at end of file |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** \brief Check that the given offset exists or not */ |
| 42 | 42 | public function offsetExists($offset) |
| 43 | 43 | { |
| 44 | -<<<<<<< HEAD |
|
| 44 | +<< << <<< HEAD |
|
| 45 | 45 | return isset($this->container[$offset]); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -63,6 +63,4 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // If not return the data from the array after checking it is set |
| 66 | - return isset($this->container[$offset]) ? $this->container[$offset] : null; |
|
| 67 | - } |
|
| 68 | -} |
|
| 66 | + return isset($this->container[$offset]) ? $this->container[$offset |
|
| 69 | 67 | \ No newline at end of file |
@@ -63,6 +63,4 @@ |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // If not return the data from the array after checking it is set |
| 66 | - return isset($this->container[$offset]) ? $this->container[$offset] : null; |
|
| 67 | - } |
|
| 68 | -} |
|
| 66 | + return isset($this->container[$offset]) ? $this->container[$offset |
|
| 69 | 67 | \ No newline at end of file |
@@ -63,6 +63,4 @@ |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // If not return the data from the array after checking it is set |
| 66 | - return isset($this->container[$offset]) ? $this->container[$offset] : null; |
|
| 67 | - } |
|
| 68 | -} |
|
| 66 | + return isset($this->container[$offset]) ? $this->container[$offset |
|
| 69 | 67 | \ No newline at end of file |
@@ -102,10 +102,4 @@ |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - return $message; |
|
| 106 | - } |
|
| 107 | -} |
|
| 108 | - |
|
| 109 | -/* |
|
| 110 | - * @} |
|
| 111 | - */ |
|
| 105 | + return $message |
|
| 112 | 106 | \ No newline at end of file |
@@ -102,10 +102,4 @@ |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - return $message; |
|
| 106 | - } |
|
| 107 | -} |
|
| 108 | - |
|
| 109 | -/* |
|
| 110 | - * @} |
|
| 111 | - */ |
|
| 105 | + return $message |
|
| 112 | 106 | \ No newline at end of file |
@@ -102,10 +102,4 @@ |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - return $message; |
|
| 106 | - } |
|
| 107 | -} |
|
| 108 | - |
|
| 109 | -/* |
|
| 110 | - * @} |
|
| 111 | - */ |
|
| 105 | + return $message |
|
| 112 | 106 | \ No newline at end of file |
@@ -102,10 +102,4 @@ |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - return $message; |
|
| 106 | - } |
|
| 107 | -} |
|
| 108 | - |
|
| 109 | -/* |
|
| 110 | - * @} |
|
| 111 | - */ |
|
| 105 | + return $message |
|
| 112 | 106 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | namespace PhpBotFramework\Utilities; |
| 20 | 20 | |
| 21 | -<<<<<<< HEAD |
|
| 21 | +<< << <<< HEAD |
|
| 22 | 22 | /** |
| 23 | 23 | * \addtogroup Modules |
| 24 | 24 | * @{ |
@@ -102,10 +102,4 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - return $message; |
|
| 106 | - } |
|
| 107 | -} |
|
| 108 | - |
|
| 109 | -/* |
|
| 110 | - * @} |
|
| 111 | - */ |
|
| 105 | + return $message |
|
| 112 | 106 | \ No newline at end of file |
@@ -102,10 +102,4 @@ |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - return $message; |
|
| 106 | - } |
|
| 107 | -} |
|
| 108 | - |
|
| 109 | -/* |
|
| 110 | - * @} |
|
| 111 | - */ |
|
| 105 | + return $message |
|
| 112 | 106 | \ No newline at end of file |
@@ -102,10 +102,4 @@ |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - return $message; |
|
| 106 | - } |
|
| 107 | -} |
|
| 108 | - |
|
| 109 | -/* |
|
| 110 | - * @} |
|
| 111 | - */ |
|
| 105 | + return $message |
|
| 112 | 106 | \ No newline at end of file |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param CoreBot $bot References to the bot that's using the inline keyboard. |
| 39 | 39 | * @param array $buttons Buttons passed as inizialization. |
| 40 | 40 | */ |
| 41 | - public function __construct(CoreBot &$bot, array $buttons = array()) |
|
| 41 | + public function __construct(CoreBot & $bot, array $buttons = array()) |
|
| 42 | 42 | { |
| 43 | 43 | $this->bot = $bot; |
| 44 | 44 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function getBackButton(bool $json_serialized = true) |
| 56 | 56 | { |
| 57 | 57 | // Create the button |
| 58 | - $inline_keyboard = [ 'inline_keyboard' => |
|
| 58 | + $inline_keyboard = ['inline_keyboard' => |
|
| 59 | 59 | [ |
| 60 | 60 | [ |
| 61 | 61 | [ |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public function getBackSkipKeyboard(bool $json_serialized = true) |
| 91 | 91 | { |
| 92 | 92 | // Create the keyboard |
| 93 | - $inline_keyboard = [ 'inline_keyboard' => |
|
| 93 | + $inline_keyboard = ['inline_keyboard' => |
|
| 94 | 94 | [ |
| 95 | 95 | [ |
| 96 | 96 | [ |