| @@ -13,8 +13,7 @@ | ||
| 13 | 13 |          if (file_exists('BPT.log') && !(filesize('BPT.log') > self::$log_size * 1024 * 1024)) {
 | 
| 14 | 14 | $mode = 'a'; | 
| 15 | 15 | $write = false; | 
| 16 | - } | |
| 17 | -        else {
 | |
| 16 | +        } else {
 | |
| 18 | 17 | $mode = 'w'; | 
| 19 | 18 | $write = true; | 
| 20 | 19 | } | 
| @@ -6,8 +6,7 @@ discard block | ||
| 6 | 6 |      public function __call (string $name, array $arguments) {
 | 
| 7 | 7 |          if (!isset($arguments[1]) && is_array($arguments[0])) {
 | 
| 8 | 8 | request::$name(...$arguments[0]); | 
| 9 | - } | |
| 10 | -        else {
 | |
| 9 | +        } else {
 | |
| 11 | 10 | request::$name($arguments); | 
| 12 | 11 | } | 
| 13 | 12 | } | 
| @@ -15,8 +14,7 @@ discard block | ||
| 15 | 14 |      public static function __callStatic (string $name, array $arguments) {
 | 
| 16 | 15 |          if (!isset($arguments[1]) && is_array($arguments[0])) {
 | 
| 17 | 16 | request::$name(...$arguments[0]); | 
| 18 | - } | |
| 19 | -        else {
 | |
| 17 | +        } else {
 | |
| 20 | 18 | request::$name(...$arguments); | 
| 21 | 19 | } | 
| 22 | 20 | } | 
| @@ -230,8 +230,7 @@ discard block | ||
| 230 | 230 | self::keysName($action,$arguments); | 
| 231 | 231 | self::readyFile($action,$arguments); | 
| 232 | 232 | print_r($arguments); | 
| 233 | - } | |
| 234 | -        else {
 | |
| 233 | +        } else {
 | |
| 235 | 234 |              logger::write("$name method is not supported",'error');
 | 
| 236 | 235 | } | 
| 237 | 236 | } | 
| @@ -256,8 +255,7 @@ discard block | ||
| 256 | 255 | $arguments['media'][$key]['media'] = new CURLFile($media['media']); | 
| 257 | 256 | } | 
| 258 | 257 | } | 
| 259 | - } | |
| 260 | -        elseif ($file_params = self::methodFile($name)) {
 | |
| 258 | +        } elseif ($file_params = self::methodFile($name)) {
 | |
| 261 | 259 |              foreach ($file_params as $param) {
 | 
| 262 | 260 |                  if (isset($arguments[$param]) && file_exists($arguments[$param])) {
 | 
| 263 | 261 | $arguments[$param] = new CURLFile($arguments[$param]); | 
| @@ -12,11 +12,9 @@ | ||
| 12 | 12 |      public static function init() {
 | 
| 13 | 13 |          if (lock::exist('BPT-MULTI-EXEC')) {
 | 
| 14 | 14 | self::setUpdate(exec::init()); | 
| 15 | - } | |
| 16 | -        elseif(lock::exist('BPT-MULTI-CURL')) {
 | |
| 15 | +        } elseif(lock::exist('BPT-MULTI-CURL')) {
 | |
| 17 | 16 | self::setUpdate(curl::init()); | 
| 18 | - } | |
| 19 | -        else {
 | |
| 17 | +        } else {
 | |
| 20 | 18 | self::deleteOldLocks(); | 
| 21 | 19 | self::checkURL(); | 
| 22 | 20 | self::setCertificate(); | 
| @@ -24,8 +24,7 @@ | ||
| 24 | 24 |      private static function loadData(): bool|int|string {
 | 
| 25 | 25 |          if (lock::exist('getUpdate')) {
 | 
| 26 | 26 |              $last_update_id = lock::read('getUpdate');
 | 
| 27 | - } | |
| 28 | -        else {
 | |
| 27 | +        } else {
 | |
| 29 | 28 | self::deleteOldLocks(); | 
| 30 | 29 | telegram::deleteWebhook(); | 
| 31 | 30 | $last_update_id = 0; | 
| @@ -14,14 +14,12 @@ discard block | ||
| 14 | 14 |      public static function init () {
 | 
| 15 | 15 |          if (settings::$multi) {
 | 
| 16 | 16 | multi::init(); | 
| 17 | - } | |
| 18 | -        else {
 | |
| 17 | +        } else {
 | |
| 19 | 18 |              if (lock::exist('BPT-HOOK')) {
 | 
| 20 | 19 | receiver::telegramVerify(); | 
| 21 | 20 | receiver::processUpdate(); | 
| 22 | 21 |                  logger::write('Update received , lets process it ;)');
 | 
| 23 | - } | |
| 24 | -            else {
 | |
| 22 | +            } else {
 | |
| 25 | 23 | self::deleteOldLocks(); | 
| 26 | 24 | self::checkURL(); | 
| 27 | 25 | self::setCertificate(); | 
| @@ -49,8 +47,7 @@ discard block | ||
| 49 | 47 | $res = telegram::setWebhook($url, settings::$certificate, max_connections:settings::$max_connection, allowed_updates : settings::$allowed_updates); | 
| 50 | 48 |          if ($res->ok) {
 | 
| 51 | 49 |              logger::write('Webhook was set successfully',loggerTypes::INFO);
 | 
| 52 | - } | |
| 53 | -        else {
 | |
| 50 | +        } else {
 | |
| 54 | 51 |              logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR);
 | 
| 55 | 52 | BPT::exit(print_r($res,true)); | 
| 56 | 53 | } | 
| @@ -72,8 +69,7 @@ discard block | ||
| 72 | 69 |              if (is_string(settings::$certificate)) {
 | 
| 73 | 70 |                  if (file_exists(settings::$certificate)) {
 | 
| 74 | 71 | settings::$certificate = new CURLFile(settings::$certificate); | 
| 75 | - } | |
| 76 | -                else {
 | |
| 72 | +                } else {
 | |
| 77 | 73 | settings::$certificate = null; | 
| 78 | 74 | } | 
| 79 | 75 | } | 
| @@ -63,26 +63,21 @@ | ||
| 63 | 63 |                  if (self::handlerExist('message')) {
 | 
| 64 | 64 | BPT::$handler->message(BPT::$update->message); | 
| 65 | 65 | } | 
| 66 | - } | |
| 67 | -            elseif (isset(BPT::$update->callback_query)) {
 | |
| 66 | +            } elseif (isset(BPT::$update->callback_query)) {
 | |
| 68 | 67 |                  if (self::handlerExist('callback_query')) {
 | 
| 69 | 68 | BPT::$handler->callback_query(BPT::$update->callback_query); | 
| 70 | 69 | } | 
| 71 | - } | |
| 72 | -            elseif (isset(BPT::$update->inline_query)) {
 | |
| 70 | +            } elseif (isset(BPT::$update->inline_query)) {
 | |
| 73 | 71 |                  if (self::handlerExist('inline_query')) {
 | 
| 74 | 72 | BPT::$handler->inline_query(BPT::$update->inline_query); | 
| 75 | 73 | } | 
| 76 | - } | |
| 77 | -            elseif (isset(BPT::$update->edited_message)) {
 | |
| 74 | +            } elseif (isset(BPT::$update->edited_message)) {
 | |
| 78 | 75 |                  if (self::handlerExist('edited_message')) {
 | 
| 79 | 76 | BPT::$handler->edited_message(BPT::$update->edited_message); | 
| 80 | 77 | } | 
| 81 | - } | |
| 82 | -            elseif (self::handlerExist('something_else')) {
 | |
| 78 | +            } elseif (self::handlerExist('something_else')) {
 | |
| 83 | 79 | BPT::$handler->something_else(BPT::$update); | 
| 84 | - } | |
| 85 | -            else {
 | |
| 80 | +            } else {
 | |
| 86 | 81 |                  logger::write('Update received but handlers does not set',loggerTypes::WARNING);
 | 
| 87 | 82 | } | 
| 88 | 83 | } | 
| @@ -36,8 +36,7 @@ discard block | ||
| 36 | 36 | $curl_handler = curl_init(settings::$base_url."$token/"); | 
| 37 | 37 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); | 
| 38 | 38 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); | 
| 39 | - } | |
| 40 | -        else{
 | |
| 39 | +        } else{
 | |
| 41 | 40 | $token = settings::$token; | 
| 42 | 41 |              if (!isset(self::$curl_handler)){
 | 
| 43 | 42 | self::$curl_handler = curl_init(settings::$base_url."$token/"); | 
| @@ -59,11 +58,9 @@ discard block | ||
| 59 | 58 |          if (isset($data['forgot'])) {
 | 
| 60 | 59 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); | 
| 61 | 60 | unset($data['forgot']); | 
| 62 | - } | |
| 63 | -        elseif ($method === 'getUpdates'){
 | |
| 61 | +        } elseif ($method === 'getUpdates'){
 | |
| 64 | 62 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); | 
| 65 | - } | |
| 66 | -        else{
 | |
| 63 | +        } else{
 | |
| 67 | 64 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 300); | 
| 68 | 65 | } | 
| 69 | 66 | } | 
| @@ -17,21 +17,18 @@ | ||
| 17 | 17 |          foreach ($object as $key=>$value) { | 
| 18 | 18 |              if (isset($subs[$key])) { | 
| 19 | 19 | $this->$key = new ($subs[$key]) ($value); | 
| 20 | - } | |
| 21 | -            else { | |
| 20 | +            } else { | |
| 22 | 21 |                  if (is_array($value)) { | 
| 23 | 22 |                      foreach ($value as $sub_key=>$sub_value) { | 
| 24 | 23 |                          if (is_array($sub_value)) { | 
| 25 | 24 |                              foreach ($sub_value as $sub2_value) { | 
| 26 | 25 | $this->$key[$sub_key][] = new ($subs['array']['array'][$key]) ($sub2_value); | 
| 27 | 26 | } | 
| 28 | - } | |
| 29 | -                        else{ | |
| 27 | +                        } else{ | |
| 30 | 28 | $this->$key[] = new ($subs['array'][$key]) ($sub_value); | 
| 31 | 29 | } | 
| 32 | 30 | } | 
| 33 | - } | |
| 34 | -                else{ | |
| 31 | +                } else{ | |
| 35 | 32 | $this->$key = $value; | 
| 36 | 33 |                      if (ucfirst($key) === basename(get_class($this)).'_id') { | 
| 37 | 34 |                          $this->{'id'} = $value; |