From d2ce6c06842a023a088ca7ac2b6d3967641a868d Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 19 Jul 2017 10:42:04 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/danog/MadelineProto/Lua.php | 7 +++++- src/danog/MadelineProto/MTProto.php | 4 +++- .../MTProtoTools/UpdateHandler.php | 2 +- .../MadelineProto/VoIP/AuthKeyHandler.php | 24 ++++++++++--------- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/danog/MadelineProto/Lua.php b/src/danog/MadelineProto/Lua.php index d958bce7..b184cbf6 100644 --- a/src/danog/MadelineProto/Lua.php +++ b/src/danog/MadelineProto/Lua.php @@ -80,7 +80,12 @@ class Lua if (is_callable($cb)) { $cb($result, $cb_extra); } - array_walk_recursive($result, function (&$value, $key) { if ($value instanceof \danog\MadelineProto\TL\Types\Button) $value = $value->jsonSerialize(); }); + array_walk_recursive($result, function (&$value, $key) { + if ($value instanceof \danog\MadelineProto\TL\Types\Button) { + $value = $value->jsonSerialize(); + } + }); + return $result; } diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 104d4158..398450c1 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -270,7 +270,9 @@ class MTProto extends \Volatile foreach ($this->calls as $id => $controller) { if (is_array($controller) || $controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { unset($this->calls[$id]); - } else var_dump($controller->getCallState()); + } else { + var_dump($controller->getCallState()); + } } // Detect ipv6 $this->ipv6 = (bool) strlen(@file_get_contents('http://ipv6.test-ipv6.com/', false, stream_context_create(['http' => ['timeout' => 1]]))) > 0; diff --git a/src/danog/MadelineProto/MTProtoTools/UpdateHandler.php b/src/danog/MadelineProto/MTProtoTools/UpdateHandler.php index 56c316fe..074110e2 100644 --- a/src/danog/MadelineProto/MTProtoTools/UpdateHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/UpdateHandler.php @@ -456,7 +456,7 @@ trait UpdateHandler switch ($update['phone_call']['_']) { case 'phoneCallRequested': return $this->accept_call($update['phone_call']); - + case 'phoneCallAccepted': $this->confirm_call($update['phone_call']); diff --git a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php index 2f8498f4..af667261 100644 --- a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php +++ b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php @@ -48,6 +48,7 @@ trait AuthKeyHandler $this->handle_pending_updates(); $this->get_updates_difference(); + return $controller; } @@ -101,19 +102,19 @@ trait AuthKeyHandler $this->calls[$params['id']]->configuration = array_merge([ 'config' => [ - 'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000, - 'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000, - 'data_saving' => \danog\MadelineProto\VoIP::DATA_SAVING_NEVER, - 'enable_NS' => true, - 'enable_AEC' => true, - 'enable_AGC' => true, - 'log_file_path' => $this->settings['calls']['log_file_path'], - 'stats_dump_file_path' => $this->settings['calls']['stats_dump_file_path'] + 'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000, + 'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000, + 'data_saving' => \danog\MadelineProto\VoIP::DATA_SAVING_NEVER, + 'enable_NS' => true, + 'enable_AEC' => true, + 'enable_AGC' => true, + 'log_file_path' => $this->settings['calls']['log_file_path'], + 'stats_dump_file_path' => $this->settings['calls']['stats_dump_file_path'], ], - 'auth_key' => $key['auth_key'], - 'network_type' => $this->settings['calls']['network_type'], + 'auth_key' => $key['auth_key'], + 'network_type' => $this->settings['calls']['network_type'], 'shared_config' => $this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), - 'endpoints' => array_merge([$res['connection']], $res['alternative_connections']), + 'endpoints' => array_merge([$res['connection']], $res['alternative_connections']), ], $this->calls[$params['id']]->configuration); $this->calls[$params['id']]->parseConfig(); $this->calls[$params['id']]->startTheMagic(); @@ -191,6 +192,7 @@ trait AuthKeyHandler unset($this->calls[$id]); } } + return $this->calls[$call]; }