Unverified Commit c1b3a82f authored by Armando Lüscher's avatar Armando Lüscher

Merge branch 'develop' into 772-simple_prevent_system_command_calls

parents 4ac95479 0e5821b2
......@@ -7,3 +7,6 @@ charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.{yml, yaml}]
indent_size = 2
/.* export-ignore
/composer.lock export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
tidelift: packagist/longman%2Ftelegram-bot
patreon: phptelegrambot
liberapay: PHP-Telegram-Bot
open_collective: php-telegram-bot
ko_fi: phptelegrambot
custom: https://github.com/php-telegram-bot/core#donate
<!-- If this is a feature request or idea, please remove all the text below this line before writing. -->
<!-- If this is a bug report or support request, please fill in the info below as accurately as you can. -->
### Required Information
<!-- Please enter exact version numbers, not just "latest" etc.! -->
- Operating system:
- PHP version:
- PHP Telegram Bot version:
- Using MySQL database: yes / no
- MySQL version:
- Update Method: Webhook / getUpdates
- Self-signed certificate: yes / no
- RAW update (if available):
### Expected behaviour
<!-- What SHOULD be happening? -->
### Actual behaviour
<!-- What IS happening? -->
### Steps to reproduce
<!-- Explain how to reproduce the issue -->
### Extra details
<!-- Please post any extra details that might help solve the issue (e.g. logs) -->
---
name: 💥 BC Break
about: Have you encountered an issue during an upgrade? 💣
---
<!--
Before reporting a BC break, please consult the changelog and wiki entry for the particular version to make sure it's not an expected change:
- https://github.com/php-telegram-bot/core/blob/master/CHANGELOG.md
- https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility
-->
### BC Break Report
<--
❗ NEVER put your Telegram API key or any other private details here. (like passwords, user IDs, etc.)
Substitute them like <API_KEY> or <USER_ID> etc.
-->
#### Required Information
<!-- Fill in the relevant information below to help triage your pull request. -->
<!-- Please enter exact version numbers, not just "latest" etc.! -->
| ? | !
| --- | ---
| Operating system | Name and version
| PHP Telegram Bot version | x.y.z
| PHP version | x.y.z
| MySQL version | x.y.z / none
| Update Method | Webhook / getUpdates
| Self-signed certificate | yes / no
| RAW update (if available) | `{...}`
#### Summary
<!-- Provide a summary describing the problem you are experiencing. -->
#### Previous behaviour
<!-- What was the previous (working) behaviour? -->
#### Current behaviour
<!-- What is the current (broken) behaviour? -->
#### How to reproduce
<!--
Provide steps to reproduce the bug.
If possible, also add any relevant code snippet.
-->
#### Expected behaviour
<!-- What was the expected (correct) behaviour? -->
---
name: 🐞 Bug Report
about: Something is broken? 🔨
---
### Bug Report
<--
❗ NEVER put your Telegram API key or any other private details here. (like passwords, user IDs, etc.)
Substitute them like <API_KEY> or <USER_ID> etc.
-->
#### Required Information
<!-- Fill in the relevant information below to help triage your pull request. -->
<!-- Please enter exact version numbers, not just "latest" etc.! -->
| ? | !
| --- | ---
| Operating system | Name and version
| PHP Telegram Bot version | x.y.z
| PHP version | x.y.z
| MySQL version | x.y.z / none
| Update Method | Webhook / getUpdates
| Self-signed certificate | yes / no
| RAW update (if available) | `{...}`
#### Summary
<!-- Provide a summary describing the problem you are experiencing. -->
### Current behaviour
<!-- What is the current (buggy) behaviour? -->
#### How to reproduce
<!--
Provide steps to reproduce the bug.
If possible, also add any relevant code snippet.
-->
#### Expected behaviour
<!-- What was the expected (correct) behaviour? -->
---
name: 🎉 Feature Request
about: You have a neat idea that should be implemented? 🎩
---
### Feature Request
#### Summary
<!-- Provide a summary of the feature you would like to see implemented. -->
---
name: ❓ Support Question
about: Have a problem that you can't figure out? 🤔
---
### Support Question
<!--
Before asking a question here, please try asking in the support group first.
https://telegram.me/PHP_Telegram_Bot_Support
Keep in mind that GitHub is primarily an issue tracker.
-->
<--
❗ NEVER put your Telegram API key or any other private details here. (like passwords, user IDs, etc.)
Substitute them like <API_KEY> or <USER_ID> etc.
-->
#### Required Information
<!-- Fill in the relevant information below to help triage your pull request. -->
<!-- Please enter exact version numbers, not just "latest" etc.! -->
| ? | !
| --- | ---
| Operating system | Name and version
| PHP Telegram Bot version | x.y.z
| PHP version | x.y.z
| MySQL version | x.y.z / none
| Update Method | Webhook / getUpdates
| Self-signed certificate | yes / no
| RAW update (if available) | `{...}`
#### Summary
<!-- Describe the issue you are facing here. -->
<!-- Important: If this pull request is not related to any issue and contains a new feature, please create an issue first for discussion. -->
<!--
Important:
If this pull request is not related to any issue and contains a new feature, please create an issue first for discussion.
https://github.com/php-telegram-bot/core/issues/new?template=Feature_Request.md
<!-- Make sure this pull request is pointed towards the "develop" branch and refers to any issue that it's related to! -->
Make sure this pull request is pointed towards the "develop" branch and refers to any issue that it's related to!
-->
<!-- Explain in detail what this pull request contains. -->
<!-- Fill in the relevant information below to help triage your pull request. -->
| ? | !
|--- | ---
| Type | bug / feature / improvement
| BC Break | yes / no
| Fixed issues | <!-- use #NUM format to reference an issue -->
#### Summary
<!-- Provide a summary of your change. -->
......@@ -5,28 +5,20 @@
.DS_Store
.idea
.phpintel
composer.phar
# Local System Files (i.e. cache, logs, etc.) #
/cache
/build/logs
/build/coverage
/tmp
# Test Related Files #
/phpunit.xml
#Exception output
TelegramException.log
# Composer
vendor/
/composer.phar
/vendor
# Test-Related Files
/clover.xml
/phpcs.xml
/phpunit.xml
# phpDocumentor Logs #
# phpDocumentor Logs
phpdoc-*
# OSX #
# OSX
._*
.Spotlight-V100
.Trashes
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
filter:
paths: [src/*]
paths:
- src/
dependency_paths:
- lib/
checks:
php:
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true
php:
check_method_contracts:
verify_interface_like_constraints: true
verify_documented_constraints: true
verify_parent_constraints: true
fix_doc_comments: true
fix_identation_4spaces: true
fix_line_ending: true
fix_linefeed: true
fix_php_opening_tag: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
more_specific_types_in_doc_comments: true
no_goto: true
param_doc_comment_if_not_inferrable: true
parameter_doc_comments: true
remove_extra_empty_lines: true
return_doc_comment_if_not_inferrable: true
return_doc_comments: true
simplify_boolean_return: true
tools:
external_code_coverage:
timeout: 120
external_code_coverage:
timeout: 300
dist: trusty
sudo: required
language: php
sudo: required
dist: trusty
addons:
mariadb: 10.1
cache:
directories:
- "$HOME/.composer/cache"
- vendor
- $HOME/.composer/cache
php:
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.2
- 7.1
- 7.0
- 5.6
- 5.5
- nightly
- hhvm
......@@ -44,7 +45,7 @@ before_script:
script:
- composer check-code
- if [ "$TRAVIS_PHP_VERSION" == "7.2" ] ; then composer test-cov; else composer test; fi
- if [ "$TRAVIS_PHP_VERSION" == "7.3" ]; then composer test-cov; else composer test; fi
after_script:
- if [ "$TRAVIS_PHP_VERSION" == "7.2" ]; then composer test-cov-upload; fi
- if [ "$TRAVIS_PHP_VERSION" == "7.3" ]; then composer test-cov-upload; fi
......@@ -5,15 +5,23 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
## [Unreleased]
### Added
- New funding and support details.
- Custom issue templates. (#972)
### Changed
- Use PSR-12 for code style.
- Some general housekeeping. (#972)
- [:exclamation:][unreleased-bc] Return an empty array for Entity properties with no items, instead of `null`. (#969)
- `TelegramLog` now adheres to [PSR-3] `LoggerInterface` and allows custom logger implementations.
### Deprecated
- Old logging that uses Monolog still works but will be removed in the near future. Use `TelegramLog::initialize($logger, $update_logger);` from now on.
- [:exclamation:][unreleased-bc-startcommand-is-now-a-usercommand] `StartCommand` is now a `UserCommand` (not `SystemCommand` any more).
### Removed
- Botan.io integration completely removed.
### Fixed
- `forward_date` is now correctly saved to the DB.
- Broken `StickerSet::getStickers()` method.
### Security
- Security disclosure managed by Tidelift.
- Don't allow a user to call system commands directly.
## [0.57.0] - 2019-06-01
......@@ -267,7 +275,11 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
- Move `hideKeyboard` to `removeKeyboard`.
[unreleased-sql-migration]: https://github.com/php-telegram-bot/core/tree/develop/utils/db-schema-update/unreleased.sql
<<<<<<< HEAD
[unreleased-bc-startcommand-is-now-a-usercommand]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#startcommand-is-now-a-usercommand
=======
[unreleased-bc]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#unreleased
>>>>>>> upstream/develop
[0.57.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.56.0-0.57.0.sql
[0.55.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.54.1-0.55.0.sql
[0.55.0-bc-move-animation-out-of-games-namespace]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#move-animation-out-of-games-namespace
......@@ -286,6 +298,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
[0.45.0-bc-up-download-directory]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#up-download-directory
[0.44.0-bc-update-content-type]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#update-getupdatecontent
[example-bot]: https://github.com/php-telegram-bot/example-bot
[PSR-3]: https://www.php-fig.org/psr/psr-3
[Unreleased]: https://github.com/php-telegram-bot/core/compare/master...develop
[0.57.0]: https://github.com/php-telegram-bot/core/compare/0.56.0...0.57.0
......
Contributing
-------------
# Contributing
The easiest way to contribute is to work on a checkout of your own fork.
When working on the `core` repository, it makes sense to rename your fork to `php-telegram-bot`.
Before you contribute code, please make sure it conforms to the PSR-2 coding standard and that the unit tests still pass.
Before you contribute code, please make sure it conforms to the PSR-12 coding standard and that the unit tests still pass.
You can run the following commands to check if everything is ready to submit:
cd php-telegram-bot
composer install
composer check-code
```bash
cd php-telegram-bot
composer install
composer check-code
```
Which should give you no output, indicating that there are no coding standard errors.
And then (remember to set up your test database!):
composer test
```bash
composer test
```
Which should give you no failures or errors. You can ignore any skipped tests as these are for external tools.
Pushing
-------
## Pushing
Development is based on the git flow branching model (see http://nvie.com/posts/a-successful-git-branching-model/)
If you fix a bug please push in hotfix branch.
If you develop a new feature please create a new branch.
Version
-------
## Version
Version number: 0.#version.#hotfix
Further code convention adopted
-------------------------------
## Further code convention adopted
- Each method and class is documented with a docblock
......
This diff is collapsed.
# Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
Tidelift will then coordinate the fix and disclosure.
......@@ -28,6 +28,7 @@
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"psr/log": "^1.1",
"monolog/monolog": "^1.24",
"guzzlehttp/guzzle": "^6.3"
},
......@@ -47,16 +48,16 @@
},
"scripts": {
"check-code": [
"\"vendor/bin/phpcs\" --standard=phpcs.xml -snp src/ tests/"
"\"vendor/bin/phpcs\" -snp src/ tests/"
],
"test": [
"\"vendor/bin/phpunit\""
],
"test-cov": [
"\"vendor/bin/phpunit\" --coverage-clover build/logs/clover.xml"
"\"vendor/bin/phpunit\" --coverage-clover clover.xml"
],
"test-cov-upload": [
"wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml"
"wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover clover.xml"
]
}
}
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b3ac8abe31dc69491d76f5b4bb65ca26",
"content-hash": "07b4a4919442371656638370b1b75f85",
"packages": [
{
"name": "guzzlehttp/guzzle",
......
## Logging
PHP Telegram Bot library features [Monolog](https://github.com/Seldaek/monolog) to store logs.
PHP Telegram Bot library features [PSR-3] compatible logging to store logs.
You can find a list of compatible packages that can be used on [Packagist][PSR-3-providers].
Logs are divided into the following streams:
### Error
Collects all the exceptions thrown by the library:
```php
TelegramLog::initErrorLog($path . '/' . $BOT_NAME . '_error.log');
```
- `error`: Collects all the exceptions thrown by the library.
- `debug`: Stores requests made to the Telegram API, useful for debugging.
- `update`: Incoming raw updates (JSON string from Webhook and getUpdates).
### Initialisation
To initialise the logger, you can pass any `LoggerInterface` objects to the `TelegramLog::initialize` method.
The first parameter is the main logger, the second one is used for the raw updates.
### Debug
Stores requests made to the Telegram API, useful for debugging:
(in this example we're using [Monolog])
```php
TelegramLog::initDebugLog($path . '/' . $BOT_NAME . '_debug.log');
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Longman\TelegramBot\TelegramLog;
TelegramLog::initialize(
// Main logger that handles all 'error' and 'debug' logs.
new Logger('telegram_bot', [
(new StreamHandler(__DIR__ . "/logs/{$bot_username}_debug.log", Logger::DEBUG))->setFormatter(new LineFormatter(null, null, true)),
(new StreamHandler(__DIR__ . "/logs/{$bot_username}_error.log", Logger::ERROR))->setFormatter(new LineFormatter(null, null, true)),
]),
// Updates logger for raw updates.
new Logger('telegram_bot_updates', [
(new StreamHandler(__DIR__ . "/logs/{$bot_username}_update.log", Logger::INFO))->setFormatter(new LineFormatter('%message%' . PHP_EOL)),
])
);
```
### Raw data
Incoming updates (JSON string from Webhook and getUpdates) get logged in a text file:
```php
TelegramLog::initUpdateLog($path . '/' . $BOT_NAME . '_update.log');
```
Why do I need to log the raw updates?
Telegram API changes continuously and it often happens that the database schema is not up to date with new entities/features. So it can happen that your table schema doesn't allow storing new valuable information coming from Telegram.
If you store the raw data you can import all updates on the newest table schema by simply using [this script](../utils/importFromLog.php).
Remember to always backup first!!
## Stream and external sources
Error and Debug streams rely on the `bot_log` instance that can be provided from an external source:
```php
TelegramLog::initialize($monolog);
```
Raw data relies on the `bot_update_log` instance that uses a custom format.
[PSR-3]: https://www.php-fig.org/psr/psr-3
[PSR-3-providers]: https://packagist.org/providers/psr/log-implementation
[Monolog]: https://github.com/Seldaek/monolog
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
bootstrap="./tests/bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
syntaxCheck="true"
timeoutForLargeTests="60"
timeoutForMediumTests="10"
timeoutForSmallTests="1"
verbose="false"
>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
bootstrap="./tests/bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
syntaxCheck="true"
timeoutForLargeTests="60"
timeoutForMediumTests="10"
timeoutForSmallTests="1"
verbose="false"
>
<php>
<ini name="error_reporting" value="-1" />
<ini name="error_reporting" value="-1"/>
<const name="PHPUNIT_TESTSUITE" value="true"/>
<const name="PHPUNIT_DB_HOST" value="127.0.0.1"/>
<const name="PHPUNIT_DB_NAME" value="telegrambot"/>
......
......@@ -13,6 +13,8 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\DB;
use Longman\TelegramBot\Entities\Chat;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Request;
class ChatsCommand extends AdminCommand
......@@ -45,8 +47,8 @@ class ChatsCommand extends AdminCommand
/**
* Command execute method
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public function execute()
{
......
......@@ -12,6 +12,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\DB;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Request;
use Longman\TelegramBot\TelegramLog;
......@@ -338,7 +339,8 @@ class CleanupCommand extends AdminCommand
/**
* Execution if MySQL is required but not available
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return ServerResponse
* @throws TelegramException
*/
public function executeNoDb()
{
......@@ -357,8 +359,8 @@ class CleanupCommand extends AdminCommand
/**
* Command execute method
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public function execute()
{
......
......@@ -12,6 +12,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\DB;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Request;
/**
......@@ -43,14 +44,14 @@ class DebugCommand extends AdminCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
* @throws TelegramException
*/
public function execute()
{
$pdo = DB::getPdo();
$pdo = DB::getPdo();
$message = $this->getMessage();
$chat = $message->getChat();
$text = strtolower($message->getText(true));
$chat = $message->getChat();
$text = strtolower($message->getText(true));
$data = ['chat_id' => $chat->getId()];
......@@ -80,7 +81,7 @@ class DebugCommand extends AdminCommand
$debug_info[] = sprintf('*Maximum PHP script execution time:* `%d seconds`', ini_get('max_execution_time'));
$mysql_version = $pdo ? $pdo->query('SELECT VERSION() AS version')->fetchColumn() : null;
$debug_info[] = sprintf('*MySQL version:* `%s`', $mysql_version ?: 'disabled');
$debug_info[] = sprintf('*MySQL version:* `%s`', $mysql_version ?: 'disabled');
$debug_info[] = sprintf('*Operating System:* `%s`', php_uname());
......@@ -88,7 +89,7 @@ class DebugCommand extends AdminCommand
$debug_info[] = sprintf('*Web Server:* `%s`', $_SERVER['SERVER_SOFTWARE']);
}
if (function_exists('curl_init')) {
$curlversion = curl_version();
$curlversion = curl_version();
$debug_info[] = sprintf('*curl version:* `%1$s; %2$s`', $curlversion['version'], $curlversion['ssl_version']);
}
......@@ -105,8 +106,8 @@ class DebugCommand extends AdminCommand
}
$webhook_info_result_str = json_encode($webhook_info_result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
$debug_info[] = $webhook_info_title;
$debug_info[] = sprintf(
$debug_info[] = $webhook_info_title;
$debug_info[] = sprintf(
'```' . PHP_EOL . '%s```',
$webhook_info_result_str
);
......@@ -116,7 +117,7 @@ class DebugCommand extends AdminCommand
}
$data['parse_mode'] = 'Markdown';
$data['text'] = implode(PHP_EOL, $debug_info);
$data['text'] = implode(PHP_EOL, $debug_info);
return Request::sendMessage($data);
}
......
......@@ -13,6 +13,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\Entities\Message;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Request;
/**
......@@ -48,8 +49,8 @@ class SendtoallCommand extends AdminCommand
/**
* Execute command
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public function execute()
{
......
......@@ -15,6 +15,8 @@ use Longman\TelegramBot\Conversation;
use Longman\TelegramBot\Entities\Chat;
use Longman\TelegramBot\Entities\Keyboard;
use Longman\TelegramBot\Entities\Message;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Request;
class SendtochannelCommand extends AdminCommand
......@@ -47,15 +49,15 @@ class SendtochannelCommand extends AdminCommand
/**
* Conversation Object
*
* @var \Longman\TelegramBot\Conversation
* @var Conversation
*/
protected $conversation;
/**
* Command execute method
*
* @return \Longman\TelegramBot\Entities\ServerResponse|mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse|mixed
* @throws TelegramException
*/
public function execute()
{
......@@ -272,11 +274,11 @@ class SendtochannelCommand extends AdminCommand
* @todo This method will be moved to a higher level maybe in AdminCommand or Command
* @todo Looking for a more significant name
*
* @param \Longman\TelegramBot\Entities\Message $message
* @param array $data
* @param Message $message
* @param array $data
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
protected function sendBack(Message $message, array $data)
{
......@@ -311,12 +313,12 @@ class SendtochannelCommand extends AdminCommand
/**
* Publish a message to a channel and return success or failure message in markdown format
*
* @param \Longman\TelegramBot\Entities\Message $message
* @param string|int $channel_id
* @param string|null $caption
* @param Message $message
* @param string|int $channel_id
* @param string|null $caption
*
* @return string
* @throws \Longman\TelegramBot\Exception\TelegramException
* @throws TelegramException
*/
protected function publish(Message $message, $channel_id, $caption = null)
{
......@@ -351,7 +353,7 @@ class SendtochannelCommand extends AdminCommand
* @todo Why send just to the first found channel?
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
* @throws TelegramException
*/
public function executeNoDb()
{
......
......@@ -16,7 +16,9 @@ use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\DB;
use Longman\TelegramBot\Entities\Chat;
use Longman\TelegramBot\Entities\PhotoSize;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Entities\UserProfilePhotos;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Request;
/**
......@@ -52,8 +54,8 @@ class WhoisCommand extends AdminCommand
/**
* Command execute method
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public function execute()
{
......
......@@ -18,7 +18,9 @@ use Longman\TelegramBot\Entities\Message;
use Longman\TelegramBot\Entities\Payments\PreCheckoutQuery;
use Longman\TelegramBot\Entities\Payments\ShippingQuery;
use Longman\TelegramBot\Entities\Poll;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Entities\Update;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Request;
use Longman\TelegramBot\Telegram;
......@@ -43,14 +45,14 @@ abstract class Command
/**
* Telegram object
*
* @var \Longman\TelegramBot\Telegram
* @var Telegram
*/
protected $telegram;
/**
* Update object
*
* @var \Longman\TelegramBot\Entities\Update
* @var Update
*/
protected $update;
......@@ -120,8 +122,8 @@ abstract class Command
/**
* Constructor
*
* @param \Longman\TelegramBot\Telegram $telegram
* @param \Longman\TelegramBot\Entities\Update $update
* @param Telegram $telegram
* @param Update $update
*/
public function __construct(Telegram $telegram, Update $update = null)
{
......@@ -133,9 +135,9 @@ abstract class Command
/**
* Set update object
*
* @param \Longman\TelegramBot\Entities\Update $update
* @param Update $update
*
* @return \Longman\TelegramBot\Commands\Command
* @return Command
*/
public function setUpdate(Update $update = null)
{
......@@ -149,8 +151,8 @@ abstract class Command
/**
* Pre-execute command
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public function preExecute()
{
......@@ -182,16 +184,16 @@ abstract class Command
/**
* Execute command
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
abstract public function execute();
/**
* Execution if MySQL is required but not available
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public function executeNoDb()
{
......@@ -210,7 +212,7 @@ abstract class Command
/**
* Get update object
*
* @return \Longman\TelegramBot\Entities\Update
* @return Update
*/
public function getUpdate()
{
......@@ -260,7 +262,7 @@ abstract class Command
/**
* Get telegram object
*
* @return \Longman\TelegramBot\Telegram
* @return Telegram
*/
public function getTelegram()
{
......@@ -399,7 +401,8 @@ abstract class Command
* @param string $text
* @param array $data
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return ServerResponse
* @throws TelegramException
*/
public function replyToChat($text, array $data = [])
{
......@@ -419,7 +422,8 @@ abstract class Command
* @param string $text
* @param array $data
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return ServerResponse
* @throws TelegramException
*/
public function replyToUser($text, array $data = [])
{
......
......@@ -10,6 +10,7 @@
namespace Longman\TelegramBot\Commands;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Request;
abstract class SystemCommand extends Command
......@@ -27,7 +28,7 @@ abstract class SystemCommand extends Command
* Although system commands should just work and return a successful ServerResponse,
* each system command can override this method to add custom functionality.
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return ServerResponse
*/
public function execute()
{
......
......@@ -42,7 +42,6 @@ class CallbackqueryCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class ChannelchatcreatedCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class ChannelpostCommand extends SystemCommand
* Execute command
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class ChoseninlineresultCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class DeletechatphotoCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class EditedchannelpostCommand extends SystemCommand
* Execute command
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class EditedmessageCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -11,7 +11,7 @@
namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Request;
use Longman\TelegramBot\Entities\ServerResponse;
/**
* Generic command
......@@ -36,8 +36,7 @@ class GenericCommand extends SystemCommand
/**
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
*/
public function execute()
{
......
......@@ -10,9 +10,11 @@
namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Conversation;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Request;
use Longman\TelegramBot\Commands\SystemCommand;
/**
* Generic message command
......@@ -42,7 +44,7 @@ class GenericmessageCommand extends SystemCommand
/**
* Execution if MySQL is required but not available
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return ServerResponse
*/
public function executeNoDb()
{
......@@ -53,8 +55,8 @@ class GenericmessageCommand extends SystemCommand
/**
* Execute command
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class GroupchatcreatedCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -11,8 +11,6 @@
namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Entities\InlineQuery\InlineQueryResultArticle;
use Longman\TelegramBot\Entities\InputMessageContent\InputTextMessageContent;
use Longman\TelegramBot\Request;
/**
......@@ -39,7 +37,6 @@ class InlinequeryCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class LeftchatmemberCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class MigratefromchatidCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class MigratetochatidCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class NewchatmembersCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class NewchatphotoCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class NewchattitleCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class PinnedmessageCommand extends SystemCommand
* Execute command
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -38,7 +38,6 @@ class SupergroupchatcreatedCommand extends SystemCommand
* Command execute method
*
* @return mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
......
......@@ -11,6 +11,8 @@
namespace Longman\TelegramBot\Commands\UserCommands;
use Longman\TelegramBot\Commands\UserCommand;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Exception\TelegramException;
/**
* Start command
......@@ -40,8 +42,8 @@ class StartCommand extends UserCommand
/**
* Command execute method
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public function execute()
{
......
......@@ -10,6 +10,8 @@
namespace Longman\TelegramBot;
use Longman\TelegramBot\Exception\TelegramException;
/**
* Class Conversation
*
......@@ -67,7 +69,7 @@ class Conversation
* @param int $chat_id
* @param string $command
*
* @throws \Longman\TelegramBot\Exception\TelegramException
* @throws TelegramException
*/
public function __construct($user_id, $chat_id, $command = null)
{
......@@ -100,7 +102,7 @@ class Conversation
* Load the conversation from the database
*
* @return bool
* @throws \Longman\TelegramBot\Exception\TelegramException
* @throws TelegramException
*/
protected function load()
{
......@@ -140,7 +142,7 @@ class Conversation
* Start a new conversation if the current command doesn't have one yet
*
* @return bool
* @throws \Longman\TelegramBot\Exception\TelegramException
* @throws TelegramException
*/
protected function start()
{
......@@ -164,6 +166,7 @@ class Conversation
* Currently the Conversation is not deleted but just set to 'stopped'
*
* @return bool
* @throws TelegramException
*/
public function stop()
{
......@@ -174,6 +177,7 @@ class Conversation
* Cancel the current conversation
*
* @return bool
* @throws TelegramException
*/
public function cancel()
{
......@@ -186,6 +190,7 @@ class Conversation
* @param string $status
*
* @return bool
* @throws TelegramException
*/
protected function updateStatus($status)
{
......@@ -209,6 +214,7 @@ class Conversation
* Store the array/variable in the database with json_encode() function
*
* @return bool
* @throws TelegramException
*/
public function update()
{
......
......@@ -844,7 +844,7 @@ class DB
$sth->bindValue(':id', $poll->getId());
$sth->bindValue(':question', $poll->getQuestion());
$sth->bindValue(':options', self::entitiesArrayToJson($poll->getOptions()));
$sth->bindValue(':options', self::entitiesArrayToJson($poll->getOptions() ?: null));
$sth->bindValue(':is_closed', $poll->getIsClosed());
$sth->bindValue(':created_at', self::getTimestamp());
......@@ -976,13 +976,13 @@ class DB
$sth->bindValue(':media_group_id', $message->getMediaGroupId());
$sth->bindValue(':author_signature', $message->getAuthorSignature());
$sth->bindValue(':text', $message->getText());
$sth->bindValue(':entities', self::entitiesArrayToJson($message->getEntities()));
$sth->bindValue(':caption_entities', self::entitiesArrayToJson($message->getCaptionEntities()));
$sth->bindValue(':entities', self::entitiesArrayToJson($message->getEntities() ?: null));
$sth->bindValue(':caption_entities', self::entitiesArrayToJson($message->getCaptionEntities() ?: null));
$sth->bindValue(':audio', $message->getAudio());
$sth->bindValue(':document', $message->getDocument());
$sth->bindValue(':animation', $message->getAnimation());
$sth->bindValue(':game', $message->getGame());
$sth->bindValue(':photo', self::entitiesArrayToJson($message->getPhoto()));
$sth->bindValue(':photo', self::entitiesArrayToJson($message->getPhoto() ?: null));
$sth->bindValue(':sticker', $message->getSticker());
$sth->bindValue(':video', $message->getVideo());
$sth->bindValue(':voice', $message->getVoice());
......@@ -995,7 +995,7 @@ class DB
$sth->bindValue(':new_chat_members', $new_chat_members_ids);
$sth->bindValue(':left_chat_member', $left_chat_member_id);
$sth->bindValue(':new_chat_title', $message->getNewChatTitle());
$sth->bindValue(':new_chat_photo', self::entitiesArrayToJson($message->getNewChatPhoto()));
$sth->bindValue(':new_chat_photo', self::entitiesArrayToJson($message->getNewChatPhoto() ?: null));
$sth->bindValue(':delete_chat_photo', $message->getDeleteChatPhoto());
$sth->bindValue(':group_chat_created', $message->getGroupChatCreated());
$sth->bindValue(':supergroup_chat_created', $message->getSupergroupChatCreated());
......@@ -1058,7 +1058,7 @@ class DB
$sth->bindValue(':user_id', $user_id);
$sth->bindValue(':edit_date', $edit_date);
$sth->bindValue(':text', $edited_message->getText());
$sth->bindValue(':entities', self::entitiesArrayToJson($edited_message->getEntities()));
$sth->bindValue(':entities', self::entitiesArrayToJson($edited_message->getEntities() ?: null));
$sth->bindValue(':caption', $edited_message->getCaption());
return $sth->execute();
......@@ -1186,13 +1186,13 @@ class DB
* @param integer $chat_id
* @param string $inline_message_id
*
* @return array|bool Array containing TOTAL and CURRENT fields or false on invalid arguments
* @return array Array containing TOTAL and CURRENT fields or false on invalid arguments
* @throws TelegramException
*/
public static function getTelegramRequestCount($chat_id = null, $inline_message_id = null)
{
if (!self::isDbConnected()) {
return false;
return [];
}
try {
......
......@@ -30,7 +30,7 @@ class CallbackQuery extends Entity
/**
* {@inheritdoc}
*/
public function subEntities()
protected function subEntities()
{
return [
'from' => User::class,
......
......@@ -46,7 +46,7 @@ class Chat extends Entity
/**
* {@inheritdoc}
*/
public function subEntities()
protected function subEntities()
{
return [
'photo' => ChatPhoto::class,
......
......@@ -38,7 +38,7 @@ class ChatMember extends Entity
/**
* {@inheritdoc}
*/
public function subEntities()
protected function subEntities()
{
return [
'user' => User::class,
......
......@@ -33,8 +33,6 @@ abstract class Entity
*
* @param array $data
* @param string $bot_username
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct($data, $bot_username = '')
{
......@@ -96,8 +94,6 @@ abstract class Entity
/**
* Perform any special entity validation
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
protected function validate()
{
......@@ -142,7 +138,13 @@ abstract class Entity
$sub_entities = $this->subEntities();
if (isset($sub_entities[$property_name])) {
return new $sub_entities[$property_name]($property, $this->getProperty('bot_username'));
$class = $sub_entities[$property_name];
if (is_array($class)) {
return $this->makePrettyObjectArray(reset($class), $property_name);
}
return new $class($property, $this->getProperty('bot_username'));
}
return $property;
......
......@@ -22,10 +22,12 @@ use Longman\TelegramBot\Entities\PhotoSize;
*
* @link https://core.telegram.org/bots/api#game
*
* @method string getTitle() Title of the game
* @method string getDescription() Description of the game
* @method string getText() Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
* @method Animation getAnimation() Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
* @method string getTitle() Title of the game
* @method string getDescription() Description of the game
* @method PhotoSize[] getPhoto() Photo that will be displayed in the game message in chats.
* @method string getText() Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
* @method MessageEntity[] getTextEntities() Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
* @method Animation getAnimation() Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
**/
class Game extends Entity
{
......@@ -35,39 +37,9 @@ class Game extends Entity
protected function subEntities()
{
return [
'photo' => PhotoSize::class,
'text_entities' => MessageEntity::class,
'photo' => [PhotoSize::class],
'text_entities' => [MessageEntity::class],
'animation' => Animation::class,
];
}
/**
* Photo that will be displayed in the game message in chats.
*
* This method overrides the default getPhoto method
* and returns a nice array of PhotoSize objects.
*
* @return null|\Longman\TelegramBot\Entities\PhotoSize[]
*/
public function getPhoto()
{
$pretty_array = $this->makePrettyObjectArray(PhotoSize::class, 'photo');
return empty($pretty_array) ? null : $pretty_array;
}
/**
* Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
*
* This method overrides the default getTextEntities method
* and returns a nice array of MessageEntity objects.
*
* @return null|\Longman\TelegramBot\Entities\MessageEntity[]
*/
public function getTextEntities()
{
$pretty_array = $this->makePrettyObjectArray(MessageEntity::class, 'text_entities');
return empty($pretty_array) ? null : $pretty_array;
}
}
......@@ -62,8 +62,6 @@ class InlineQueryResultArticle extends InlineEntity implements InlineQueryResult
* InlineQueryResultArticle constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -56,8 +56,6 @@ class InlineQueryResultAudio extends InlineEntity implements InlineQueryResult
* InlineQueryResultAudio constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -47,8 +47,6 @@ class InlineQueryResultCachedAudio extends InlineEntity implements InlineQueryRe
* InlineQueryResultCachedAudio constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -53,8 +53,6 @@ class InlineQueryResultCachedDocument extends InlineEntity implements InlineQuer
* InlineQueryResultCachedDocument constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -50,8 +50,6 @@ class InlineQueryResultCachedGif extends InlineEntity implements InlineQueryResu
* InlineQueryResultCachedGif constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -50,8 +50,6 @@ class InlineQueryResultCachedMpeg4Gif extends InlineEntity implements InlineQuer
* InlineQueryResultCachedMpeg4Gif constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -53,8 +53,6 @@ class InlineQueryResultCachedPhoto extends InlineEntity implements InlineQueryRe
* InlineQueryResultCachedPhoto constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -44,8 +44,6 @@ class InlineQueryResultCachedSticker extends InlineEntity implements InlineQuery
* InlineQueryResultCachedSticker constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -53,8 +53,6 @@ class InlineQueryResultCachedVideo extends InlineEntity implements InlineQueryRe
* InlineQueryResultCachedVideo constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -50,8 +50,6 @@ class InlineQueryResultCachedVoice extends InlineEntity implements InlineQueryRe
* InlineQueryResultCachedVoice constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -61,8 +61,6 @@ class InlineQueryResultContact extends InlineEntity implements InlineQueryResult
* InlineQueryResultContact constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -65,8 +65,6 @@ class InlineQueryResultDocument extends InlineEntity implements InlineQueryResul
* InlineQueryResultDocument constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -40,8 +40,6 @@ class InlineQueryResultGame extends InlineEntity implements InlineQueryResult
* InlineQueryResultGame constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -61,8 +61,6 @@ class InlineQueryResultGif extends InlineEntity implements InlineQueryResult
* InlineQueryResultGif constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -62,8 +62,6 @@ class InlineQueryResultLocation extends InlineEntity implements InlineQueryResul
* InlineQueryResultLocation constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -61,8 +61,6 @@ class InlineQueryResultMpeg4Gif extends InlineEntity implements InlineQueryResul
* InlineQueryResultMpeg4Gif constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -62,8 +62,6 @@ class InlineQueryResultPhoto extends InlineEntity implements InlineQueryResult
* InlineQueryResultPhoto constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -67,8 +67,6 @@ class InlineQueryResultVenue extends InlineEntity implements InlineQueryResult
* InlineQueryResultVenue constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -68,8 +68,6 @@ class InlineQueryResultVideo extends InlineEntity implements InlineQueryResult
* InlineQueryResultVideo constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -53,8 +53,6 @@ class InlineQueryResultVoice extends InlineEntity implements InlineQueryResult
* InlineQueryResultVoice constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -4,5 +4,20 @@ namespace Longman\TelegramBot\Entities\InputMedia;
interface InputMedia
{
/**
* @return string Type of the result.
*/
public function getType();
/**
* @return string File to send.
*/
public function getMedia();
/**
* @param string $media File to send.
*
* @return string
*/
public function setMedia($media);
}
......@@ -52,8 +52,6 @@ class InputMediaAnimation extends Entity implements InputMedia
* InputMediaAnimation constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -52,8 +52,6 @@ class InputMediaAudio extends Entity implements InputMedia
* InputMediaAudio constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -43,8 +43,6 @@ class InputMediaDocument extends Entity implements InputMedia
* InputMediaDocument constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -40,8 +40,6 @@ class InputMediaPhoto extends Entity implements InputMedia
* InputMediaPhoto constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -55,8 +55,6 @@ class InputMediaVideo extends Entity implements InputMedia
* InputMediaVideo constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -54,7 +54,7 @@ class Keyboard extends Entity
/**
* Get the proper keyboard button class for this keyboard.
*
* @return KeyboardButton|InlineKeyboardButton
* @return string
*/
public function getKeyboardButtonClass()
{
......@@ -154,9 +154,9 @@ class Keyboard extends Entity
/**
* Parse a given button to the correct KeyboardButton object type.
*
* @param array|string|\Longman\TelegramBot\Entities\KeyboardButton $button
* @param array|string|KeyboardButton $button
*
* @return \Longman\TelegramBot\Entities\KeyboardButton|null
* @return KeyboardButton|null
*/
protected function parseButton($button)
{
......@@ -166,7 +166,7 @@ class Keyboard extends Entity
return $button;
}
if (!$this->isInlineKeyboard() || $button_class::couldBe($button)) {
if (!$this->isInlineKeyboard() || call_user_func([$button_class, 'couldBe'], $button)) {
return new $button_class($button);
}
......@@ -179,7 +179,7 @@ class Keyboard extends Entity
protected function validate()
{
$keyboard_type = $this->getKeyboardType();
$keyboard = $this->getProperty($keyboard_type);
$keyboard = $this->getProperty($keyboard_type);
if ($keyboard !== null) {
if (!is_array($keyboard)) {
......@@ -201,8 +201,7 @@ class Keyboard extends Entity
*
* @param array $data
*
* @return \Longman\TelegramBot\Entities\Keyboard
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return Keyboard
*/
public static function remove(array $data = [])
{
......@@ -216,8 +215,7 @@ class Keyboard extends Entity
*
* @param array $data
*
* @return \Longman\TelegramBot\Entities\Keyboard
* @throws \Longman\TelegramBot\Exception\TelegramException
* @return Keyboard
*/
public static function forceReply(array $data = [])
{
......
......@@ -34,10 +34,13 @@ use Longman\TelegramBot\Entities\TelegramPassport\PassportData;
* @method int getEditDate() Optional. Date the message was last edited in Unix time
* @method string getMediaGroupId() Optional. The unique identifier of a media message group this message belongs to
* @method string getAuthorSignature() Optional. Signature of the post author for messages in channels
* @method MessageEntity[] getEntities() Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
* @method MessageEntity[] getCaptionEntities() Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
* @method Audio getAudio() Optional. Message is an audio file, information about the file
* @method Document getDocument() Optional. Message is a general file, information about the file
* @method Animation getAnimation() Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set
* @method Game getGame() Optional. Message is a game, information about the game.
* @method PhotoSize[] getPhoto() Optional. Message is a photo, available sizes of the photo
* @method Sticker getSticker() Optional. Message is a sticker, information about the sticker
* @method Video getVideo() Optional. Message is a video, information about the video
* @method Voice getVoice() Optional. Message is a voice message, information about the file
......@@ -47,8 +50,10 @@ use Longman\TelegramBot\Entities\TelegramPassport\PassportData;
* @method Location getLocation() Optional. Message is a shared location, information about the location
* @method Venue getVenue() Optional. Message is a venue, information about the venue
* @method Poll getPoll() Optional. Message is a native poll, information about the poll
* @method User[] getNewChatMembers() Optional. A new member(s) was added to the group, information about them (one of this members may be the bot itself)
* @method User getLeftChatMember() Optional. A member was removed from the group, information about them (this member may be the bot itself)
* @method string getNewChatTitle() Optional. A chat title was changed to this value
* @method PhotoSize[] getNewChatPhoto() Optional. A chat photo was changed to this value
* @method bool getDeleteChatPhoto() Optional. Service message: the chat photo was deleted
* @method bool getGroupChatCreated() Optional. Service message: the group has been created
* @method bool getSupergroupChatCreated() Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
......@@ -74,13 +79,13 @@ class Message extends Entity
'forward_from' => User::class,
'forward_from_chat' => Chat::class,
'reply_to_message' => ReplyToMessage::class,
'entities' => MessageEntity::class,
'caption_entities' => MessageEntity::class,
'entities' => [MessageEntity::class],
'caption_entities' => [MessageEntity::class],
'audio' => Audio::class,
'document' => Document::class,
'animation' => Animation::class,
'game' => Game::class,
'photo' => PhotoSize::class,
'photo' => [PhotoSize::class],
'sticker' => Sticker::class,
'video' => Video::class,
'voice' => Voice::class,
......@@ -89,9 +94,9 @@ class Message extends Entity
'location' => Location::class,
'venue' => Venue::class,
'poll' => Poll::class,
'new_chat_members' => User::class,
'new_chat_members' => [User::class],
'left_chat_member' => User::class,
'new_chat_photo' => PhotoSize::class,
'new_chat_photo' => [PhotoSize::class],
'pinned_message' => Message::class,
'invoice' => Invoice::class,
'successful_payment' => SuccessfulPayment::class,
......@@ -99,94 +104,6 @@ class Message extends Entity
];
}
/**
* Message constructor
*
* @param array $data
* @param string $bot_username
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data, $bot_username = '')
{
parent::__construct($data, $bot_username);
}
/**
* Optional. Message is a photo, available sizes of the photo
*
* This method overrides the default getPhoto method
* and returns a nice array of PhotoSize objects.
*
* @return null|PhotoSize[]
*/
public function getPhoto()
{
$pretty_array = $this->makePrettyObjectArray(PhotoSize::class, 'photo');
return empty($pretty_array) ? null : $pretty_array;
}
/**
* Optional. A chat photo was changed to this value
*
* This method overrides the default getNewChatPhoto method
* and returns a nice array of PhotoSize objects.
*
* @return null|PhotoSize[]
*/
public function getNewChatPhoto()
{
$pretty_array = $this->makePrettyObjectArray(PhotoSize::class, 'new_chat_photo');
return empty($pretty_array) ? null : $pretty_array;
}
/**
* Optional. A new member(s) was added to the group, information about them (one of this members may be the bot itself)
*
* This method overrides the default getNewChatMembers method
* and returns a nice array of User objects.
*
* @return null|User[]
*/
public function getNewChatMembers()
{
$pretty_array = $this->makePrettyObjectArray(User::class, 'new_chat_members');
return empty($pretty_array) ? null : $pretty_array;
}
/**
* Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
*
* This method overrides the default getEntities method
* and returns a nice array of MessageEntity objects.
*
* @return null|MessageEntity[]
*/
public function getEntities()
{
$pretty_array = $this->makePrettyObjectArray(MessageEntity::class, 'entities');
return empty($pretty_array) ? null : $pretty_array;
}
/**
* Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
*
* This method overrides the default getCaptionEntities method
* and returns a nice array of MessageEntity objects.
*
* @return null|MessageEntity[]
*/
public function getCaptionEntities()
{
$pretty_array = $this->makePrettyObjectArray(MessageEntity::class, 'caption_entities');
return empty($pretty_array) ? null : $pretty_array;
}
/**
* return the entire command like /echo or /echo@bot1 if specified
*
......@@ -264,7 +181,6 @@ class Message extends Entity
* Bot added in chat
*
* @return bool
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function botAddedInChat()
{
......
......@@ -29,7 +29,7 @@ class OrderInfo extends Entity
/**
* {@inheritdoc}
*/
public function subEntities()
protected function subEntities()
{
return [
'shipping_address' => ShippingAddress::class,
......
......@@ -11,6 +11,7 @@
namespace Longman\TelegramBot\Entities\Payments;
use Longman\TelegramBot\Entities\Entity;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Entities\User;
use Longman\TelegramBot\Request;
......@@ -34,7 +35,7 @@ class PreCheckoutQuery extends Entity
/**
* {@inheritdoc}
*/
public function subEntities()
protected function subEntities()
{
return [
'from' => User::class,
......@@ -48,7 +49,7 @@ class PreCheckoutQuery extends Entity
* @param bool $ok
* @param array $data
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return ServerResponse
*/
public function answer($ok, array $data = [])
{
......
......@@ -19,8 +19,9 @@ use Longman\TelegramBot\Entities\Entity;
*
* @link https://core.telegram.org/bots/api#shippingoption
*
* @method string getId() Shipping option identifier
* @method string getTitle() Option title
* @method string getId() Shipping option identifier
* @method string getTitle() Option title
* @method LabeledPrice[] getPrices() List of price portions
**/
class ShippingOption extends Entity
{
......@@ -30,19 +31,7 @@ class ShippingOption extends Entity
protected function subEntities()
{
return [
'prices' => LabeledPrice::class,
'prices' => [LabeledPrice::class],
];
}
/**
* List of price portions
*
* This method overrides the default getPrices method and returns a nice array
*
* @return LabeledPrice[]
*/
public function getPrices()
{
return $this->makePrettyObjectArray(LabeledPrice::class, 'prices');
}
}
......@@ -11,6 +11,7 @@
namespace Longman\TelegramBot\Entities\Payments;
use Longman\TelegramBot\Entities\Entity;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Entities\User;
use Longman\TelegramBot\Request;
......@@ -31,7 +32,7 @@ class ShippingQuery extends Entity
/**
* {@inheritdoc}
*/
public function subEntities()
protected function subEntities()
{
return [
'from' => User::class,
......@@ -45,7 +46,7 @@ class ShippingQuery extends Entity
* @param bool $ok
* @param array $data
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return ServerResponse
*/
public function answer($ok, array $data = [])
{
......
......@@ -32,7 +32,7 @@ class SuccessfulPayment extends Entity
/**
* {@inheritdoc}
*/
public function subEntities()
protected function subEntities()
{
return [
'order_info' => OrderInfo::class,
......
......@@ -17,9 +17,10 @@ namespace Longman\TelegramBot\Entities;
*
* @link https://core.telegram.org/bots/api#poll
*
* @method string getId() Unique poll identifier
* @method string getQuestion() Poll question, 1-255 characters
* @method bool getIsClosed() True, if the poll is closed
* @method string getId() Unique poll identifier
* @method string getQuestion() Poll question, 1-255 characters
* @method PollOption[] getOptions() List of poll options
* @method bool getIsClosed() True, if the poll is closed
*/
class Poll extends Entity
{
......@@ -29,22 +30,7 @@ class Poll extends Entity
protected function subEntities()
{
return [
'options' => PollOption::class,
'options' => [PollOption::class],
];
}
/**
* List of poll options
*
* This method overrides the default getOptions method
* and returns a nice array of PollOption objects.
*
* @return null|PollOption[]
*/
public function getOptions()
{
$pretty_array = $this->makePrettyObjectArray(PollOption::class, 'options');
return empty($pretty_array) ? null : $pretty_array;
}
}
......@@ -22,8 +22,6 @@ class ReplyToMessage extends Message
*
* @param array $data
* @param string $bot_username
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data, $bot_username = '')
{
......
......@@ -30,8 +30,6 @@ class ServerResponse extends Entity
*
* @param array $data
* @param string $bot_username
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data, $bot_username)
{
......@@ -105,7 +103,7 @@ class ServerResponse extends Entity
* @param array $result
* @param string $bot_username
*
* @return \Longman\TelegramBot\Entities\Chat|\Longman\TelegramBot\Entities\ChatMember|\Longman\TelegramBot\Entities\File|\Longman\TelegramBot\Entities\Message|\Longman\TelegramBot\Entities\User|\Longman\TelegramBot\Entities\UserProfilePhotos|\Longman\TelegramBot\Entities\WebhookInfo
* @return Chat|ChatMember|File|Message|User|UserProfilePhotos|WebhookInfo
*/
private function createResultObject(array $result, $bot_username)
{
......@@ -135,7 +133,7 @@ class ServerResponse extends Entity
* @param array $result
* @param string $bot_username
*
* @return \Longman\TelegramBot\Entities\ChatMember[]|\Longman\TelegramBot\Entities\Games\GameHighScore[]|\Longman\TelegramBot\Entities\Message[]|\Longman\TelegramBot\Entities\Update[]
* @return ChatMember[]|GameHighScore[]|Message[]|Update[]
*/
private function createResultObjects(array $result, $bot_username)
{
......
......@@ -15,24 +15,20 @@ namespace Longman\TelegramBot\Entities;
*
* @link https://core.telegram.org/bots/api#stickerset
*
* @method string getName() Sticker set name
* @method string getTitle() Sticker set title
* @method bool getContainsMasks() True, if the sticker set contains masks
* @method string getName() Sticker set name
* @method string getTitle() Sticker set title
* @method bool getContainsMasks() True, if the sticker set contains masks
* @method Sticker[] getStickers() List of all set stickers
*/
class StickerSet extends Entity
{
/**
* List of all set stickers
*
* This method overrides the default getStickers method
* and returns a nice array of Sticker objects.
*
* @return null|Sticker[]
* {@inheritdoc}
*/
public function getStickers()
protected function subEntities()
{
$pretty_array = $this->makePrettyObjectArray(Sticker::class, 'stickers');
return empty($pretty_array) ? null : $pretty_array;
return [
'stickers' => [Sticker::class],
];
}
}
......@@ -19,14 +19,16 @@ use Longman\TelegramBot\Entities\Entity;
*
* @link https://core.telegram.org/bots/api#encryptedpassportelement
*
* @method string getType() Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
* @method string getData() Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “identity_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials.
* @method string getPhoneNumber() Optional. User's verified phone number, available only for “phone_number” type
* @method string getEmail() Optional. User's verified email address, available only for “email” type
* @method PassportFile getFrontSide() Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
* @method PassportFile getReverseSide() Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
* @method PassportFile getSelfie() Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
* @method string getHash() Base64-encoded element hash for using in PassportElementErrorUnspecified
* @method string getType() Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
* @method string getData() Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “identity_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials.
* @method string getPhoneNumber() Optional. User's verified phone number, available only for “phone_number” type
* @method string getEmail() Optional. User's verified email address, available only for “email” type
* @method PassportFile[] getFiles() Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
* @method PassportFile getFrontSide() Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
* @method PassportFile getReverseSide() Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
* @method PassportFile getSelfie() Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
* @method PassportFile[] getTranslation() Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
* @method string getHash() Base64-encoded element hash for using in PassportElementErrorUnspecified
**/
class EncryptedPassportElement extends Entity
{
......@@ -36,41 +38,11 @@ class EncryptedPassportElement extends Entity
protected function subEntities()
{
return [
'files' => PassportFile::class,
'files' => [PassportFile::class],
'front_side' => PassportFile::class,
'reverse_side' => PassportFile::class,
'selfie' => PassportFile::class,
'translation' => PassportFile::class,
'translation' => [PassportFile::class],
];
}
/**
* Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
*
* This method overrides the default getFiles method
* and returns a nice array of PassportFile objects.
*
* @return null|PassportFile[]
*/
public function getFiles()
{
$pretty_array = $this->makePrettyObjectArray(PassportFile::class, 'files');
return empty($pretty_array) ? null : $pretty_array;
}
/**
* Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
*
* This method overrides the default getTranslation method
* and returns a nice array of PassportFile objects.
*
* @return null|PassportFile[]
*/
public function getTranslation()
{
$pretty_array = $this->makePrettyObjectArray(PassportFile::class, 'translation');
return empty($pretty_array) ? null : $pretty_array;
}
}
......@@ -19,7 +19,8 @@ use Longman\TelegramBot\Entities\Entity;
*
* @link https://core.telegram.org/bots/api#passportdata
*
* @method EncryptedCredentials getCredentials() Encrypted credentials required to decrypt the data
* @method EncryptedPassportElement[] getData() Array with information about documents and other Telegram Passport elements that was shared with the bot
* @method EncryptedCredentials getCredentials() Encrypted credentials required to decrypt the data
**/
class PassportData extends Entity
{
......@@ -29,23 +30,8 @@ class PassportData extends Entity
protected function subEntities()
{
return [
'data' => EncryptedPassportElement::class,
'data' => [EncryptedPassportElement::class],
'credentials' => EncryptedCredentials::class,
];
}
/**
* Array with information about documents and other Telegram Passport elements that was shared with the bot
*
* This method overrides the default getData method
* and returns a nice array of EncryptedPassportElement objects.
*
* @return null|EncryptedPassportElement[]
*/
public function getData()
{
$pretty_array = $this->makePrettyObjectArray(EncryptedPassportElement::class, 'data');
return empty($pretty_array) ? null : $pretty_array;
}
}
......@@ -31,8 +31,6 @@ class PassportElementErrorDataField extends Entity implements PassportElementErr
* PassportElementErrorDataField constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -30,8 +30,6 @@ class PassportElementErrorFile extends Entity implements PassportElementError
* PassportElementErrorFile constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
......@@ -30,8 +30,6 @@ class PassportElementErrorFiles extends Entity implements PassportElementError
* PassportElementErrorFiles constructor
*
* @param array $data
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function __construct(array $data = [])
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment