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->session = $realpaths['file'];
}
return;
}
$this->session = $realpaths['file'];

View File

@ -132,7 +132,9 @@ class Logger
$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;
if (self::$isatty) self::$mode = 3;
if (self::$isatty) {
self::$mode = 3;
}
switch (self::$mode) {
case 1:
error_log($param);

View File

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

View File

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

View File

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

View File

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