Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2018-04-16 11:58:52 +00:00 committed by StyleCI Bot
parent 040babd24d
commit 549ead2e25
3 changed files with 12 additions and 3 deletions

View File

@ -4,4 +4,3 @@ require 'vendor/autoload.php';
$handler = new \danog\MadelineProto\Server(['type' => AF_INET, 'protocol' => 0, 'address' => 'localhost', 'port' => 8011]);
$handler->start();

View File

@ -170,10 +170,14 @@ class API extends APIFactory
$this->API->wrapper = $this;
}
}
public function get_all_methods()
{
$methods = [];
foreach ($this->API->methods->by_id as $method) { $methods []= $method['method']; }
foreach ($this->API->methods->by_id as $method) {
$methods[] = $method['method'];
}
return array_merge($methods, get_class_methods($this->API));
}

View File

@ -101,9 +101,12 @@ class Handler extends \danog\MadelineProto\Connection
$message = $this->read_message();
}
} catch (\danog\MadelineProto\NothingInTheSocketException $e) {
if (time() - $time < 2) $this->sock = null;
if (time() - $time < 2) {
$this->sock = null;
}
continue;
}
try {
$message = $this->deserialize($message, ['type' => '', 'datacenter' => '']);
if ($message['_'] !== 'socketMessageRequest') {
@ -158,14 +161,17 @@ class Handler extends \danog\MadelineProto\Connection
$arg['file'] = fopen('madelineSocket://', 'r+b', false, Stream::getContext($zis, $arg['file']['stream_id']));
}
$arg = new \danog\MadelineProto\FileCallback($arg['file'], [$zis, $arg['callback']['callback']]);
return;
}
if ($arg['_'] === 'callback' && isset($arg['callback']) && !method_exists($zis, $arg['callback'])) {
$arg = [$zis, $arg['callback']];
return;
}
if ($arg['_'] === 'stream' && isset($arg['stream_id'])) {
$arg = fopen('madelineSocket://', 'r+b', false, Stream::getContext($zis, $arg['stream_id']));
return;
}
}