Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2017-01-26 02:56:24 +00:00 committed by StyleCI Bot
parent 0430264c4e
commit e6255d088c
3 changed files with 15 additions and 5 deletions

View File

@ -28,7 +28,9 @@ class Logger
const WARNING = 'WARNING'; const WARNING = 'WARNING';
const ERROR = 'ERROR'; const ERROR = 'ERROR';
const FATAL_ERROR = 'FATAL ERROR'; const FATAL_ERROR = 'FATAL ERROR';
public static function level2num($level) {
public static function level2num($level)
{
switch ($level) { switch ($level) {
case self::ULTRA_VERBOSE: return 5; case self::ULTRA_VERBOSE: return 5;
case self::VERBOSE: return 4; case self::VERBOSE: return 4;
@ -39,6 +41,7 @@ class Logger
default: return false; default: return false;
} }
} }
/* /*
* Constructor function * Constructor function
* Accepts various logger modes: * Accepts various logger modes:
@ -65,7 +68,13 @@ class Logger
throw new Exception("The constructor function wasn't called! Please call the constructor function before using this method."); throw new Exception("The constructor function wasn't called! Please call the constructor function before using this method.");
} }
$level = self::level2num(end($params)); $level = self::level2num(end($params));
if ($level !== false) { if ($level > self::$level) return false; else array_pop($params); }; if ($level !== false) {
if ($level > self::$level) {
return false;
} else {
array_pop($params);
}
}
foreach ($params as $param) { foreach ($params as $param) {
if (!is_string($param)) { if (!is_string($param)) {
$param = var_export($param, true); $param = var_export($param, true);

View File

@ -46,6 +46,7 @@ trait RSA
\danog\MadelineProto\Logger::log('Generating BigInteger object for fingerprint...', LOGGER::ULTRA_VERBOSE); \danog\MadelineProto\Logger::log('Generating BigInteger object for fingerprint...', LOGGER::ULTRA_VERBOSE);
$keydata['fp'] = new \phpseclib\Math\BigInteger(strrev($keydata['fp_bytes']), -256); $keydata['fp'] = new \phpseclib\Math\BigInteger(strrev($keydata['fp_bytes']), -256);
return $keydata; return $keydata;
} }