Reformat the file

parent a9679668
...@@ -144,7 +144,7 @@ class DB ...@@ -144,7 +144,7 @@ class DB
]; ];
foreach ($tables as $table) { foreach ($tables as $table) {
$table_name = 'TB_' . strtoupper($table); $table_name = 'TB_' . strtoupper($table);
if (!defined($table_name)) { if (! defined($table_name)) {
define($table_name, self::$table_prefix . $table); define($table_name, self::$table_prefix . $table);
} }
} }
...@@ -181,7 +181,7 @@ class DB ...@@ -181,7 +181,7 @@ class DB
*/ */
public static function selectTelegramUpdate($limit = null, $id = null) public static function selectTelegramUpdate($limit = null, $id = null)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -228,7 +228,7 @@ class DB ...@@ -228,7 +228,7 @@ class DB
*/ */
public static function selectMessages($limit = null) public static function selectMessages($limit = null)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -281,7 +281,7 @@ class DB ...@@ -281,7 +281,7 @@ class DB
*/ */
public static function entitiesArrayToJson($entities, $default = null) public static function entitiesArrayToJson($entities, $default = null)
{ {
if (!is_array($entities)) { if (! is_array($entities)) {
return $default; return $default;
} }
...@@ -322,7 +322,7 @@ class DB ...@@ -322,7 +322,7 @@ class DB
throw new TelegramException('message_id, inline_query_id, chosen_inline_result_id, callback_query_id, edited_message_id are all null'); throw new TelegramException('message_id, inline_query_id, chosen_inline_result_id, callback_query_id, edited_message_id are all null');
} }
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -360,7 +360,7 @@ class DB ...@@ -360,7 +360,7 @@ class DB
*/ */
public static function insertUser(User $user, $date = null, Chat $chat = null) public static function insertUser(User $user, $date = null, Chat $chat = null)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -428,7 +428,7 @@ class DB ...@@ -428,7 +428,7 @@ class DB
*/ */
public static function insertChat(Chat $chat, $date = null, $migrate_to_chat_id = null) public static function insertChat(Chat $chat, $date = null, $migrate_to_chat_id = null)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -485,7 +485,7 @@ class DB ...@@ -485,7 +485,7 @@ class DB
*/ */
public static function insertRequest(Update $update) public static function insertRequest(Update $update)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -506,7 +506,7 @@ class DB ...@@ -506,7 +506,7 @@ class DB
$message_id $message_id
); );
} }
} elseif ($update_type === 'edited_message') { } else if ($update_type === 'edited_message') {
$edited_message = $update->getEditedMessage(); $edited_message = $update->getEditedMessage();
if (self::insertEditedMessageRequest($edited_message)) { if (self::insertEditedMessageRequest($edited_message)) {
...@@ -523,7 +523,7 @@ class DB ...@@ -523,7 +523,7 @@ class DB
$edited_message_local_id $edited_message_local_id
); );
} }
} elseif ($update_type === 'channel_post') { } else if ($update_type === 'channel_post') {
$channel_post = $update->getChannelPost(); $channel_post = $update->getChannelPost();
if (self::insertMessageRequest($channel_post)) { if (self::insertMessageRequest($channel_post)) {
...@@ -536,7 +536,7 @@ class DB ...@@ -536,7 +536,7 @@ class DB
$message_id $message_id
); );
} }
} elseif ($update_type === 'edited_channel_post') { } else if ($update_type === 'edited_channel_post') {
$edited_channel_post = $update->getEditedChannelPost(); $edited_channel_post = $update->getEditedChannelPost();
if (self::insertEditedMessageRequest($edited_channel_post)) { if (self::insertEditedMessageRequest($edited_channel_post)) {
...@@ -553,7 +553,7 @@ class DB ...@@ -553,7 +553,7 @@ class DB
$edited_channel_post_local_id $edited_channel_post_local_id
); );
} }
} elseif ($update_type === 'inline_query') { } else if ($update_type === 'inline_query') {
$inline_query = $update->getInlineQuery(); $inline_query = $update->getInlineQuery();
if (self::insertInlineQueryRequest($inline_query)) { if (self::insertInlineQueryRequest($inline_query)) {
...@@ -566,7 +566,7 @@ class DB ...@@ -566,7 +566,7 @@ class DB
$inline_query_id $inline_query_id
); );
} }
} elseif ($update_type === 'chosen_inline_result') { } else if ($update_type === 'chosen_inline_result') {
$chosen_inline_result = $update->getChosenInlineResult(); $chosen_inline_result = $update->getChosenInlineResult();
if (self::insertChosenInlineResultRequest($chosen_inline_result)) { if (self::insertChosenInlineResultRequest($chosen_inline_result)) {
...@@ -580,7 +580,7 @@ class DB ...@@ -580,7 +580,7 @@ class DB
$chosen_inline_result_local_id $chosen_inline_result_local_id
); );
} }
} elseif ($update_type === 'callback_query') { } else if ($update_type === 'callback_query') {
$callback_query = $update->getCallbackQuery(); $callback_query = $update->getCallbackQuery();
if (self::insertCallbackQueryRequest($callback_query)) { if (self::insertCallbackQueryRequest($callback_query)) {
...@@ -610,7 +610,7 @@ class DB ...@@ -610,7 +610,7 @@ class DB
*/ */
public static function insertInlineQueryRequest(InlineQuery $inline_query) public static function insertInlineQueryRequest(InlineQuery $inline_query)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -654,7 +654,7 @@ class DB ...@@ -654,7 +654,7 @@ class DB
*/ */
public static function insertChosenInlineResultRequest(ChosenInlineResult $chosen_inline_result) public static function insertChosenInlineResultRequest(ChosenInlineResult $chosen_inline_result)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -698,7 +698,7 @@ class DB ...@@ -698,7 +698,7 @@ class DB
*/ */
public static function insertCallbackQueryRequest(CallbackQuery $callback_query) public static function insertCallbackQueryRequest(CallbackQuery $callback_query)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -767,7 +767,7 @@ class DB ...@@ -767,7 +767,7 @@ class DB
*/ */
public static function insertMessageRequest(Message $message) public static function insertMessageRequest(Message $message)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -804,7 +804,7 @@ class DB ...@@ -804,7 +804,7 @@ class DB
$new_chat_members = $message->getNewChatMembers(); $new_chat_members = $message->getNewChatMembers();
$left_chat_member = $message->getLeftChatMember(); $left_chat_member = $message->getLeftChatMember();
if (!empty($new_chat_members)) { if (! empty($new_chat_members)) {
foreach ($new_chat_members as $new_chat_member) { foreach ($new_chat_members as $new_chat_member) {
if ($new_chat_member instanceof User) { if ($new_chat_member instanceof User) {
// Insert the new chat user // Insert the new chat user
...@@ -813,7 +813,7 @@ class DB ...@@ -813,7 +813,7 @@ class DB
} }
} }
$new_chat_members_ids = implode(',', $new_chat_members_ids); $new_chat_members_ids = implode(',', $new_chat_members_ids);
} elseif ($left_chat_member instanceof User) { } else if ($left_chat_member instanceof User) {
// Insert the left chat user // Insert the left chat user
self::insertUser($left_chat_member, $date, $chat); self::insertUser($left_chat_member, $date, $chat);
$left_chat_member_id = $left_chat_member->getId(); $left_chat_member_id = $left_chat_member->getId();
...@@ -915,7 +915,7 @@ class DB ...@@ -915,7 +915,7 @@ class DB
*/ */
public static function insertEditedMessageRequest(Message $edited_message) public static function insertEditedMessageRequest(Message $edited_message)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -968,7 +968,7 @@ class DB ...@@ -968,7 +968,7 @@ class DB
*/ */
public static function selectChats($select_chats_params) public static function selectChats($select_chats_params)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -984,7 +984,7 @@ class DB ...@@ -984,7 +984,7 @@ class DB
'text' => null, 'text' => null,
], $select_chats_params); ], $select_chats_params);
if (!$select['groups'] && !$select['users'] && !$select['supergroups'] && !$select['channels']) { if (! $select['groups'] && ! $select['users'] && ! $select['supergroups'] && ! $select['channels']) {
return false; return false;
} }
...@@ -1011,7 +1011,7 @@ class DB ...@@ -1011,7 +1011,7 @@ class DB
$where = []; $where = [];
$tokens = []; $tokens = [];
if (!$select['groups'] || !$select['users'] || !$select['supergroups'] || !$select['channels']) { if (! $select['groups'] || ! $select['users'] || ! $select['supergroups'] || ! $select['channels']) {
$chat_or_user = []; $chat_or_user = [];
$select['groups'] && $chat_or_user[] = TB_CHAT . '.`type` = "group"'; $select['groups'] && $chat_or_user[] = TB_CHAT . '.`type` = "group"';
...@@ -1056,7 +1056,7 @@ class DB ...@@ -1056,7 +1056,7 @@ class DB
} }
} }
if (!empty($where)) { if (! empty($where)) {
$query .= ' WHERE ' . implode(' AND ', $where); $query .= ' WHERE ' . implode(' AND ', $where);
} }
...@@ -1082,7 +1082,7 @@ class DB ...@@ -1082,7 +1082,7 @@ class DB
*/ */
public static function getTelegramRequestCount($chat_id = null, $inline_message_id = null) public static function getTelegramRequestCount($chat_id = null, $inline_message_id = null)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -1122,7 +1122,7 @@ class DB ...@@ -1122,7 +1122,7 @@ class DB
*/ */
public static function insertTelegramRequest($method, $data) public static function insertTelegramRequest($method, $data)
{ {
if (!self::isDbConnected()) { if (! self::isDbConnected()) {
return false; return false;
} }
...@@ -1159,7 +1159,7 @@ class DB ...@@ -1159,7 +1159,7 @@ class DB
*/ */
public static function update($table, array $fields_values, array $where_fields_values) public static function update($table, array $fields_values, array $where_fields_values)
{ {
if (empty($fields_values) || !self::isDbConnected()) { if (empty($fields_values) || ! self::isDbConnected()) {
return false; return false;
} }
......
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