diff --git a/src/danog/MadelineProto/Connection.php b/src/danog/MadelineProto/Connection.php index 716272e06..39ca831ff 100644 --- a/src/danog/MadelineProto/Connection.php +++ b/src/danog/MadelineProto/Connection.php @@ -157,7 +157,9 @@ class Connection case 'http': case 'https': $this->parsed = parse_url($ip); - if ($this->parsed['host'][0] === '[') $this->parsed['host'] = substr($this->parsed['host'], 1, -1); + if ($this->parsed['host'][0] === '[') { + $this->parsed['host'] = substr($this->parsed['host'], 1, -1); + } $this->sock = new $proxy($ipv6 ? \AF_INET6 : \AF_INET, \SOCK_STREAM, getprotobyname($this->protocol === 'https' ? 'tls' : 'tcp')); if ($has_proxy && $this->extra !== []) { $this->sock->setExtra($this->extra); diff --git a/src/danog/MadelineProto/DataCenter.php b/src/danog/MadelineProto/DataCenter.php index 59534c2f6..5bceb97df 100644 --- a/src/danog/MadelineProto/DataCenter.php +++ b/src/danog/MadelineProto/DataCenter.php @@ -100,7 +100,9 @@ class DataCenter } if ($this->settings[$dc_config_number]['protocol'] === 'http') { - if ($ipv6) $address = '['.$address.']'; + if ($ipv6) { + $address = '['.$address.']'; + } $address = $this->settings[$dc_config_number]['protocol'].'://'.$address.'/api'; } \danog\MadelineProto\Logger::log([sprintf(\danog\MadelineProto\Lang::$current_lang['dc_con_test_start'], $dc_number, $test, $ipv6, $this->settings[$dc_config_number]['protocol'])], \danog\MadelineProto\Logger::VERBOSE); diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 4b6f23d8a..a65bd005a 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -630,11 +630,14 @@ class MTProto $socket->new_incoming = []; } } - public function is_http($datacenter) { + + public function is_http($datacenter) + { return in_array($this->datacenter->sockets[$datacenter]->protocol, ['http', 'https']); } - public function close_and_reopen($datacenter) { + public function close_and_reopen($datacenter) + { $this->datacenter->sockets[$datacenter]->close_and_reopen(); if ($this->is_http($datacenter)) { $this->method_call('http_wait', ['max_wait' => 0, 'wait_after' => 0, 'max_delay' => 0], ['datacenter' => $datacenter]); diff --git a/src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php b/src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php index 01d423e2a..43ca2deb3 100644 --- a/src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php @@ -553,7 +553,9 @@ trait AuthKeyHandler if ($res === true) { \danog\MadelineProto\Logger::log(['Successfully binded temporary and permanent authorization keys, DC '.$datacenter], \danog\MadelineProto\Logger::NOTICE); - if ($this->is_http($datacenter)) $this->close_and_reopen($datacenter); + if ($this->is_http($datacenter)) { + $this->close_and_reopen($datacenter); + } return true; }