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

@ -186,9 +186,9 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
* 2 - Log to file defined in second parameter * 2 - Log to file defined in second parameter
* 3 - Echo logs * 3 - Echo logs
*/ */
'logger' => 1, // write to 'logger' => 1, // write to
'logger_param' => '/tmp/MadelineProto.log', 'logger_param' => '/tmp/MadelineProto.log',
'logger' => 3, // overwrite previous setting and echo logs 'logger' => 3, // overwrite previous setting and echo logs
'logger_level' => Logger::NOTICE, // Logging level, available logging levels are: ULTRA_VERBOSE, VERBOSE, NOTICE, WARNING, ERROR, FATAL_ERROR. Can be provided as last parameter to the logging function. 'logger_level' => Logger::NOTICE, // Logging level, available logging levels are: ULTRA_VERBOSE, VERBOSE, NOTICE, WARNING, ERROR, FATAL_ERROR. Can be provided as last parameter to the logging function.
], ],
'max_tries' => [ 'max_tries' => [

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;
} }