@@ -58,11 +58,9 @@ discard block |
||
| 58 | 58 | foreach ($settings as $setting => $value) {
|
| 59 | 59 | try{
|
| 60 | 60 | self::$$setting = $value; |
| 61 | - } |
|
| 62 | - catch (TypeError){
|
|
| 61 | + } catch (TypeError){
|
|
| 63 | 62 | logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING);
|
| 64 | - } |
|
| 65 | - catch (Error){
|
|
| 63 | + } catch (Error){
|
|
| 66 | 64 | logger::write("$setting setting is not one of library settings",loggerTypes::WARNING);
|
| 67 | 65 | } |
| 68 | 66 | } |
@@ -75,13 +73,11 @@ discard block |
||
| 75 | 73 | if (!empty(self::$receiver)) {
|
| 76 | 74 | self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates(); |
| 77 | 75 | } |
| 78 | - } |
|
| 79 | - else {
|
|
| 76 | + } else {
|
|
| 80 | 77 | logger::write('token format is not right, check it and try again',loggerTypes::ERROR);
|
| 81 | 78 | throw new bptException('TOKEN_NOT_TRUE');
|
| 82 | 79 | } |
| 83 | - } |
|
| 84 | - else {
|
|
| 80 | + } else {
|
|
| 85 | 81 | logger::write('You must specify token parameter in settings',loggerTypes::ERROR);
|
| 86 | 82 | throw new bptException('TOKEN_NOT_FOUND');
|
| 87 | 83 | } |
@@ -138,8 +134,7 @@ discard block |
||
| 138 | 134 | private static function getUpdates() {
|
| 139 | 135 | if (self::$handler) {
|
| 140 | 136 | getUpdates::init(); |
| 141 | - } |
|
| 142 | - else {
|
|
| 137 | + } else {
|
|
| 143 | 138 | logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR);
|
| 144 | 139 | throw new bptException('GETUPDATE_NEED_HANDLER');
|
| 145 | 140 | } |
@@ -68,7 +68,9 @@ discard block |
||
| 68 | 68 | $keyboard_object->setOne_time_keyboard($keyboard['one_time']); |
| 69 | 69 | } |
| 70 | 70 | foreach ($keyboard as $row) { |
| 71 | - if (!is_array($row)) continue; |
|
| 71 | + if (!is_array($row)) { |
|
| 72 | + continue; |
|
| 73 | + } |
|
| 72 | 74 | $buttons = []; |
| 73 | 75 | foreach ($row as $base_button) { |
| 74 | 76 | $button_info = explode('||', $base_button); |
@@ -77,15 +79,12 @@ discard block |
||
| 77 | 79 | if (count($button_info) > 1) { |
| 78 | 80 | if ($button_info[1] === 'con') { |
| 79 | 81 | $button->setRequest_contact(true); |
| 80 | - } |
|
| 81 | - elseif ($button_info[1] === 'loc') { |
|
| 82 | + } elseif ($button_info[1] === 'loc') { |
|
| 82 | 83 | $button->setRequest_location(true); |
| 83 | - } |
|
| 84 | - elseif ($button_info[1] === 'poll') { |
|
| 84 | + } elseif ($button_info[1] === 'poll') { |
|
| 85 | 85 | $type = $button_info[2] === pollType::QUIZ ? pollType::QUIZ : pollType::REGULAR; |
| 86 | 86 | $button->setRequest_poll((new keyboardButtonPollType())->setType($type)); |
| 87 | - } |
|
| 88 | - elseif ($button_info[1] === 'web' && isset($button_info[2])) { |
|
| 87 | + } elseif ($button_info[1] === 'web' && isset($button_info[2])) { |
|
| 89 | 88 | $url = $button_info[2]; |
| 90 | 89 | $button->setWeb_app((new webAppInfo())->setUrl($url)); |
| 91 | 90 | } |
@@ -95,8 +94,7 @@ discard block |
||
| 95 | 94 | $keyboard_object->setKeyboard([$buttons]); |
| 96 | 95 | } |
| 97 | 96 | return $keyboard_object; |
| 98 | - } |
|
| 99 | - elseif (!empty($inline)) { |
|
| 97 | + } elseif (!empty($inline)) { |
|
| 100 | 98 | $keyboard_object = new inlineKeyboardMarkup(); |
| 101 | 99 | foreach ($inline as $row) { |
| 102 | 100 | $buttons = []; |
@@ -105,20 +103,17 @@ discard block |
||
| 105 | 103 | if (isset($button_info[1])) { |
| 106 | 104 | if (filter_var($button_info[1], FILTER_VALIDATE_URL) && str_starts_with($button_info[1], 'http')) { |
| 107 | 105 | $button->setText($button_info[0])->setUrl($button_info[1]); |
| 108 | - } |
|
| 109 | - else { |
|
| 106 | + } else { |
|
| 110 | 107 | $button->setText($button_info[0])->setCallback_data($button_info[1]); |
| 111 | 108 | } |
| 112 | - } |
|
| 113 | - else { |
|
| 109 | + } else { |
|
| 114 | 110 | $button->setText($button_info[0])->setUrl('https://t.me/BPT_CH'); |
| 115 | 111 | } |
| 116 | 112 | } |
| 117 | 113 | $keyboard_object->setInline_keyboard([$buttons]); |
| 118 | 114 | } |
| 119 | 115 | return $keyboard_object; |
| 120 | - } |
|
| 121 | - else { |
|
| 116 | + } else { |
|
| 122 | 117 | logger::write("tools::eKey function used\nkeyboard or inline parameter must be set",loggerTypes::ERROR); |
| 123 | 118 | throw new bptException('ARGUMENT_NOT_FOUND_KEYBOARD_INLINE'); |
| 124 | 119 | } |