1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 10:59:02 +01:00

Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2018-03-12 21:11:18 +00:00 committed by StyleCI Bot
parent 071be3bb80
commit 0918be3060
6 changed files with 42 additions and 31 deletions

View File

@ -70,6 +70,7 @@ class API extends APIFactory
$this->APIFactory(); $this->APIFactory();
$this->session = $realpaths['file']; $this->session = $realpaths['file'];
} }
return; return;
} }
$this->session = $realpaths['file']; $this->session = $realpaths['file'];

View File

@ -132,7 +132,9 @@ class Logger
$param = json_encode($param, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); $param = json_encode($param, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
} }
$param = str_pad(basename(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]['file'], '.php').$prefix.': ', 16 + strlen($prefix))."\t".$param; $param = str_pad(basename(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]['file'], '.php').$prefix.': ', 16 + strlen($prefix))."\t".$param;
if (self::$isatty) self::$mode = 3; if (self::$isatty) {
self::$mode = 3;
}
switch (self::$mode) { switch (self::$mode) {
case 1: case 1:
error_log($param); error_log($param);

View File

@ -30,15 +30,18 @@ trait PeerHandler
return ($log - intval($log)) * 1000 < 10; return ($log - intval($log)) * 1000 < 10;
} }
public function handle_pending_pwrchat() { public function handle_pending_pwrchat()
{
if ($this->postpone_pwrchat || empty($this->pending_pwrchat)) { if ($this->postpone_pwrchat || empty($this->pending_pwrchat)) {
return false; return false;
} }
$this->postpone_pwrchat = true; $this->postpone_pwrchat = true;
try { try {
\danog\MadelineProto\Logger::log("Handling pending pwrchat queries...", \danog\MadelineProto\Logger::VERBOSE); \danog\MadelineProto\Logger::log('Handling pending pwrchat queries...', \danog\MadelineProto\Logger::VERBOSE);
foreach ($this->pending_pwrchat as $query => $params) { foreach ($this->pending_pwrchat as $query => $params) {
unset($this->pending_pwrchat[$query]); unset($this->pending_pwrchat[$query]);
try { try {
$this->get_pwr_chat($query, ...$params); $this->get_pwr_chat($query, ...$params);
} catch (\danog\MadelineProto\Exception $e) { } catch (\danog\MadelineProto\Exception $e) {
@ -47,8 +50,11 @@ trait PeerHandler
\danog\MadelineProto\Logger::log($e->getMessage(), \danog\MadelineProto\Logger::WARNING); \danog\MadelineProto\Logger::log($e->getMessage(), \danog\MadelineProto\Logger::WARNING);
} }
} }
} finally { $this->postpone_pwrchat = false; } } finally {
$this->postpone_pwrchat = false;
} }
}
public function add_users($users) public function add_users($users)
{ {
foreach ($users as $key => $user) { foreach ($users as $key => $user) {
@ -84,7 +90,6 @@ trait PeerHandler
\danog\MadelineProto\Logger::log($e->getMessage(), \danog\MadelineProto\Logger::WARNING); \danog\MadelineProto\Logger::log($e->getMessage(), \danog\MadelineProto\Logger::WARNING);
} }
} }
} }
case 'userEmpty': case 'userEmpty':
break; break;

View File

@ -427,6 +427,7 @@ trait ResponseHandler
} }
$this->handle_pending_updates(); $this->handle_pending_updates();
\danog\MadelineProto\Logger::log('Parsing updates received via the socket...', \danog\MadelineProto\Logger::VERBOSE); \danog\MadelineProto\Logger::log('Parsing updates received via the socket...', \danog\MadelineProto\Logger::VERBOSE);
try { try {
$this->postpone_updates = true; $this->postpone_updates = true;

View File

@ -664,6 +664,7 @@ trait TL
} }
} }
} }
return $x; return $x;
} }
} }

View File

@ -33,6 +33,7 @@ if (!function_exists('readline')) {
echo 'Deserializing MadelineProto from testing.madeline...'.PHP_EOL; echo 'Deserializing MadelineProto from testing.madeline...'.PHP_EOL;
$MadelineProto = false; $MadelineProto = false;
try { try {
$MadelineProto = new \danog\MadelineProto\API('testing.madeline'); $MadelineProto = new \danog\MadelineProto\API('testing.madeline');
} catch (\danog\MadelineProto\Exception $e) { } catch (\danog\MadelineProto\Exception $e) {