Fix code style

parent 6b4a1cc9
...@@ -103,13 +103,19 @@ class DebugCommand extends AdminCommand ...@@ -103,13 +103,19 @@ class DebugCommand extends AdminCommand
if (empty($request->json()->all())) { if (empty($request->json()->all())) {
$debug_info[] = $webhook_info_title . ' `Using getUpdates method, not Webhook.`'; $debug_info[] = $webhook_info_title . ' `Using getUpdates method, not Webhook.`';
} else { } else {
$webhook_info_result = json_decode(Client::getWebhookInfo(), true)['result']; /** @var \Longman\TelegramBot\Http\Response $response */
$response = Client::getWebhookInfo();
/** @var \Longman\TelegramBot\Entities\WebhookInfo $result */
$result = $response->getResult();
$webhook_info_result = $result->getRawData();
// Add a human-readable error date string if necessary. // Add a human-readable error date string if necessary.
if (isset($webhook_info_result['last_error_date'])) { if (isset($webhook_info_result['last_error_date'])) {
$webhook_info_result['last_error_date_string'] = date('Y-m-d H:i:s', $webhook_info_result['last_error_date']); $webhook_info_result['last_error_date_string'] = date('Y-m-d H:i:s', $webhook_info_result['last_error_date']);
} }
$webhook_info_result_str = json_encode($webhook_info_result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); $webhook_info_result_str = json_encode($webhook_info_result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$debug_info[] = $webhook_info_title; $debug_info[] = $webhook_info_title;
$debug_info[] = sprintf( $debug_info[] = sprintf(
'```' . PHP_EOL . '%s```', '```' . PHP_EOL . '%s```',
......
...@@ -38,7 +38,7 @@ abstract class Entity ...@@ -38,7 +38,7 @@ abstract class Entity
*/ */
public function __construct($data, $bot_username = '') public function __construct($data, $bot_username = '')
{ {
//Make sure we're not raw_data inception-ing // Make sure we're not raw_data inception-ing
if (array_key_exists('raw_data', $data)) { if (array_key_exists('raw_data', $data)) {
if ($data['raw_data'] === null) { if ($data['raw_data'] === null) {
unset($data['raw_data']); unset($data['raw_data']);
...@@ -48,6 +48,7 @@ abstract class Entity ...@@ -48,6 +48,7 @@ abstract class Entity
} }
$data['bot_username'] = $bot_username; $data['bot_username'] = $bot_username;
$this->assignMemberVariables($data); $this->assignMemberVariables($data);
$this->validate(); $this->validate();
} }
......
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