1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 11:34:41 +01:00

Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2018-04-17 08:40:34 +00:00 committed by StyleCI Bot
parent e600aa0c43
commit 0c537e133f
3 changed files with 13 additions and 5 deletions

View File

@ -165,7 +165,8 @@ class Handler extends \danog\MadelineProto\Connection
}
}
private function walker(&$arg) {
private function walker(&$arg)
{
if (is_array($arg)) {
if (isset($arg['_'])) {
if ($arg['_'] === 'fileCallback' && isset($arg['callback']) && isset($arg['file']) && !method_exists($this, $arg['callback']['callback'])) {
@ -173,13 +174,15 @@ class Handler extends \danog\MadelineProto\Connection
$arg['file'] = fopen('madelineSocket://', 'r+b', false, Stream::getContext($this, $arg['file']['stream_id']));
}
$arg = new \danog\MadelineProto\FileCallback($arg['file'], [$this, $arg['callback']['callback']]);
return;
} else if ($arg['_'] === 'callback' && isset($arg['callback']) && !method_exists($this, $arg['callback'])) {
} elseif ($arg['_'] === 'callback' && isset($arg['callback']) && !method_exists($this, $arg['callback'])) {
$arg = [$this, $arg['callback']];
return;
} else if ($arg['_'] === 'stream' && isset($arg['stream_id'])) {
} elseif ($arg['_'] === 'stream' && isset($arg['stream_id'])) {
$arg = fopen('madelineSocket://', 'r+b', false, Stream::getContext($this, $arg['stream_id']));
return;
} else {
array_walk($arg, [$this, 'walker']);

View File

@ -505,7 +505,9 @@ trait TL
}
if (isset($current_argument['subtype']) && in_array($current_argument['subtype'], ['DataJSON', '%DataJSON'])) {
array_walk($arguments[$current_argument['name']], function (&$arg) { $arg = ['_' => 'dataJSON', 'data' => json_encode($arg)]; });
array_walk($arguments[$current_argument['name']], function (&$arg) {
$arg = ['_' => 'dataJSON', 'data' => json_encode($arg)];
});
}
if (!is_array($arguments[$current_argument['name']]) && $current_argument['type'] === 'InputFile' && $this->settings['upload']['allow_automatic_upload']) {

View File

@ -20,5 +20,8 @@ trait Noop
$this->settings['updates']['callback'] = [$this, 'noop'];
$this->settings['updates']['handle_updates'] = true;
}
public function noop() {}
public function noop()
{
}
}