diff --git a/src/CustomHTTPProxy.php b/src/CustomHTTPProxy.php
index 78dd1002..afb5a044 100644
--- a/src/CustomHTTPProxy.php
+++ b/src/CustomHTTPProxy.php
@@ -192,6 +192,7 @@ class CustomHTTPProxy implements \danog\MadelineProto\Proxy
{
$this->options = $extra;
}
+
public function getResource()
{
return $this->sock->getResource();
diff --git a/src/HttpProxy.php b/src/HttpProxy.php
index 3ae0469d..2491892e 100644
--- a/src/HttpProxy.php
+++ b/src/HttpProxy.php
@@ -185,6 +185,7 @@ class HttpProxy implements \danog\MadelineProto\Proxy
public function getProxyHeaders()
{
}
+
public function getResource()
{
return $this->sock->getResource();
diff --git a/src/Socket.php b/src/Socket.php
index 467547c9..909f6c9c 100644
--- a/src/Socket.php
+++ b/src/Socket.php
@@ -97,14 +97,21 @@ If not, see .
}
$res = stream_select($actual_read, $actual_write, $actual_except, $tv_sec, $tv_usec);
foreach ($read as $key => $resource) {
- if (!isset($actual_read[$key])) unset($read[$key]);
+ if (!isset($actual_read[$key])) {
+ unset($read[$key]);
+ }
}
foreach ($write as $key => $resource) {
- if (!isset($actual_write[$key])) unset($write[$key]);
+ if (!isset($actual_write[$key])) {
+ unset($write[$key]);
+ }
}
foreach ($except as $key => $resource) {
- if (!isset($actual_except[$key])) unset($except[$key]);
+ if (!isset($actual_except[$key])) {
+ unset($except[$key]);
+ }
}
+
return $res;
}
@@ -147,6 +154,7 @@ If not, see .
{
return '';
}
+
public function getResource()
{
return $this->sock;
@@ -233,18 +241,24 @@ if (!extension_loaded('pthreads')) {
}
$res = socket_select($actual_read, $actual_write, $actual_except, $tv_sec, $tv_usec);
foreach ($read as $key => $resource) {
- if (!isset($actual_read[$key])) unset($read[$key]);
+ if (!isset($actual_read[$key])) {
+ unset($read[$key]);
+ }
}
foreach ($write as $key => $resource) {
- if (!isset($actual_write[$key])) unset($write[$key]);
+ if (!isset($actual_write[$key])) {
+ unset($write[$key]);
+ }
}
foreach ($except as $key => $resource) {
- if (!isset($actual_except[$key])) unset($except[$key]);
+ if (!isset($actual_except[$key])) {
+ unset($except[$key]);
+ }
}
+
return $res;
}
-
public function read(int $length, int $flags = 0)
{
return socket_read($this->sock, $length, $flags);
@@ -288,6 +302,7 @@ if (!extension_loaded('pthreads')) {
{
return '';
}
+
public function getResource()
{
return $this->sock;
diff --git a/src/danog/MadelineProto/Connection.php b/src/danog/MadelineProto/Connection.php
index 0250692e..5b90ae78 100644
--- a/src/danog/MadelineProto/Connection.php
+++ b/src/danog/MadelineProto/Connection.php
@@ -413,6 +413,7 @@ class Connection
return ['protocol' => $protocol, 'code' => $code, 'description' => $description, 'body' => $read, 'headers' => $headers];
}
+
public function getSocket()
{
return $this->sock;
diff --git a/src/danog/MadelineProto/DataCenter.php b/src/danog/MadelineProto/DataCenter.php
index be7cbdfe..82bbf1d9 100644
--- a/src/danog/MadelineProto/DataCenter.php
+++ b/src/danog/MadelineProto/DataCenter.php
@@ -144,15 +144,17 @@ class DataCenter
return $all ? array_keys((array) $this->dclist[$test][$ipv6]) : array_keys((array) $this->sockets);
}
+
public function select()
{
$read = [];
$write = [];
$except = [];
foreach ($this->sockets as $dc_id => $socket) {
- $read [$dc_id] = $socket->getSocket();
+ $read[$dc_id] = $socket->getSocket();
}
\Socket::select($read, $write, $except, 0);
+
return array_keys($read);
}
}
diff --git a/src/danog/MadelineProto/VoIP.php b/src/danog/MadelineProto/VoIP.php
index 8c03f99f..3770e039 100644
--- a/src/danog/MadelineProto/VoIP.php
+++ b/src/danog/MadelineProto/VoIP.php
@@ -227,7 +227,7 @@ if (!extension_loaded('php-libtgvoip') && false) {
private function init_all()
{
foreach ($this->datacenter->sockets as $dc_id => $socket) {
- if ($socket->auth_key === NULL) {
+ if ($socket->auth_key === null) {
$socket->auth_key = ['id' => $this->configuration['auth_key_id'], 'auth_key' => $this->configuration['auth_key']];
}
}