Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2018-03-29 11:25:42 +00:00 committed by StyleCI Bot
parent cf974a2d0a
commit a5246e782d
6 changed files with 29 additions and 9 deletions

View File

@ -192,6 +192,7 @@ class CustomHTTPProxy implements \danog\MadelineProto\Proxy
{
$this->options = $extra;
}
public function getResource()
{
return $this->sock->getResource();

View File

@ -185,6 +185,7 @@ class HttpProxy implements \danog\MadelineProto\Proxy
public function getProxyHeaders()
{
}
public function getResource()
{
return $this->sock->getResource();

View File

@ -97,14 +97,21 @@ If not, see <http://www.gnu.org/licenses/>.
}
$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 <http://www.gnu.org/licenses/>.
{
return '';
}
public function getResource()
{
return $this->sock;
@ -233,17 +241,23 @@ 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;
}
return $res;
}
public function read(int $length, int $flags = 0)
{
@ -288,6 +302,7 @@ if (!extension_loaded('pthreads')) {
{
return '';
}
public function getResource()
{
return $this->sock;

View File

@ -413,6 +413,7 @@ class Connection
return ['protocol' => $protocol, 'code' => $code, 'description' => $description, 'body' => $read, 'headers' => $headers];
}
public function getSocket()
{
return $this->sock;

View File

@ -144,6 +144,7 @@ class DataCenter
return $all ? array_keys((array) $this->dclist[$test][$ipv6]) : array_keys((array) $this->sockets);
}
public function select()
{
$read = [];
@ -153,6 +154,7 @@ class DataCenter
$read[$dc_id] = $socket->getSocket();
}
\Socket::select($read, $write, $except, 0);
return array_keys($read);
}
}

View File

@ -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']];
}
}