Commit 4abfd919 authored by Marco Boretto's avatar Marco Boretto

Merge pull request #11 from noplanman/monolog_fixes

A few suggestions
parents d6362448 7cf99e65
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
namespace Longman\TelegramBot; namespace Longman\TelegramBot;
use Longman\TelegramBot\TelegramBot;
use Longman\TelegramBot\Entities\File; use Longman\TelegramBot\Entities\File;
use Longman\TelegramBot\Entities\ServerResponse; use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Exception\TelegramException; use Longman\TelegramBot\Exception\TelegramException;
...@@ -177,9 +176,9 @@ class Request ...@@ -177,9 +176,9 @@ class Request
} }
if (TelegramLog::isDebugLogActive()) { if (TelegramLog::isDebugLogActive()) {
$curlConfig[CURLOPT_VERBOSE] = true;
$verbose_curl_output = fopen('php://temp', 'w+'); $verbose_curl_output = fopen('php://temp', 'w+');
curl_setopt($ch, CURLOPT_STDERR, $verbose_curl_output); $curlConfig[CURLOPT_VERBOSE] = true;
$curlConfig[CURLOPT_STDERR] = $verbose_curl_output;
} }
curl_setopt_array($ch, $curlConfig); curl_setopt_array($ch, $curlConfig);
...@@ -199,10 +198,13 @@ class Request ...@@ -199,10 +198,13 @@ class Request
self::setInputRaw($result); self::setInputRaw($result);
} }
$curl_error = curl_error($ch);
$curl_errno = curl_errno($ch);
curl_close($ch); curl_close($ch);
if ($result === false) { if ($result === false) {
throw new TelegramException(curl_error($ch), curl_errno($ch)); throw new TelegramException($curl_error, $curl_errno);
} }
if (empty($result) | is_null($result)) { if (empty($result) | is_null($result)) {
throw new TelegramException('Empty server response'); throw new TelegramException('Empty server response');
......
...@@ -136,10 +136,7 @@ class TelegramLog ...@@ -136,10 +136,7 @@ class TelegramLog
*/ */
public static function isErrorLogActive() public static function isErrorLogActive()
{ {
if (self::$error_log_path === null) { return (self::$error_log_path !== null);
return 0;
}
return 1;
} }
/** /**
...@@ -149,10 +146,7 @@ class TelegramLog ...@@ -149,10 +146,7 @@ class TelegramLog
*/ */
public static function isDebugLogActive() public static function isDebugLogActive()
{ {
if (self::$debug_log_path === null) { return (self::$debug_log_path !== null);
return 0;
}
return 1;
} }
/** /**
...@@ -162,10 +156,7 @@ class TelegramLog ...@@ -162,10 +156,7 @@ class TelegramLog
*/ */
public static function isUpdateLogActive() public static function isUpdateLogActive()
{ {
if (self::$update_log_path === null) { return (self::$update_log_path !== null);
return 0;
}
return 1;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment