Passed
Push — master ( 08545a...673498 )
by Ioannes
07:23
created
src/Log.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function __construct($channel = '') {
19 19
 
20
-        if(!empty($channel)) {
20
+        if (!empty($channel)) {
21 21
             $this->channel = $channel;
22 22
         } else {
23 23
             $this->channel = ($_ENV['APP_LOG_BITRIX_CHANNEL'] ?: 'bitrix');
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         $logger = LoggerFactory::getInstance(LoggerFactory::TELEGRAM_CHANNEL, $context);
188 188
 
189
-        if($logger) {
189
+        if ($logger) {
190 190
             try {
191 191
                 $message = FormatHelper::stringfyTelegramMessage($message, (array) $context);
192 192
                 $logger->log($level, $message, $context);
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $minDebugLevel = ($_ENV['APP_DEBUG_LEVEL'] ?: LogLevel::DEBUG);
212 212
         $minDebugLevel = Logger::toMonologLevel($minDebugLevel);
213 213
 
214
-        if($level >= $minDebugLevel) {
214
+        if ($level >= $minDebugLevel) {
215 215
             return true;
216 216
         }
217 217
         return false;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      */
223 223
     protected function logInnerException(\Exception $exception)
224 224
     {
225
-        if(class_exists('\Bitrix\Main\Diag\Debug')) {
225
+        if (class_exists('\Bitrix\Main\Diag\Debug')) {
226 226
             Debug::writeToFile((string) $exception, "", "monolog_error.log");
227 227
         } else {
228 228
             $logPath = $_SERVER['DOCUMENT_ROOT'] . ($_ENV['APP_LOG_FOLDER'] ?: '/log/');
Please login to merge, or discard this patch.
src/Monolog/LoggerFactory.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,45 +14,45 @@  discard block
 block discarded – undo
14 14
     public static function getInstance($channel, $context) {
15 15
 
16 16
         $key = md5(json_encode([$channel, $context]));
17
-        if(Registry::hasLogger($key)) {
17
+        if (Registry::hasLogger($key)) {
18 18
             return Registry::getInstance($key);
19 19
         }
20 20
 
21
-        if($channel == self::TELEGRAM_CHANNEL) {
21
+        if ($channel == self::TELEGRAM_CHANNEL) {
22 22
 
23
-            if(isset($_ENV['APP_LOG_TELEGRAM'])) {
23
+            if (isset($_ENV['APP_LOG_TELEGRAM'])) {
24 24
                 $APP_LOG_TELEGRAM = trim(strtolower($_ENV['APP_LOG_TELEGRAM']));
25
-                if($APP_LOG_TELEGRAM !== 'on' && $APP_LOG_TELEGRAM !== 'true' && $APP_LOG_TELEGRAM !== '1') {
25
+                if ($APP_LOG_TELEGRAM !== 'on' && $APP_LOG_TELEGRAM !== 'true' && $APP_LOG_TELEGRAM !== '1') {
26 26
                     return null;
27 27
                 }
28 28
             } else {
29 29
                 return null;
30 30
             }
31 31
 
32
-            if(!isset($_ENV['APP_LOG_TELEGRAM_KEY']) || empty($_ENV['APP_LOG_TELEGRAM_KEY'])) {
32
+            if (!isset($_ENV['APP_LOG_TELEGRAM_KEY']) || empty($_ENV['APP_LOG_TELEGRAM_KEY'])) {
33 33
                 return null;
34 34
             }
35
-            if(!isset($_ENV['APP_LOG_TELEGRAM_CHATID']) || empty($_ENV['APP_LOG_TELEGRAM_CHATID'])) {
35
+            if (!isset($_ENV['APP_LOG_TELEGRAM_CHATID']) || empty($_ENV['APP_LOG_TELEGRAM_CHATID'])) {
36 36
                 return null;
37 37
             }
38 38
 
39
-            if(!class_exists('\Monolog\Handler\TelegramBotHandler')) {
39
+            if (!class_exists('\Monolog\Handler\TelegramBotHandler')) {
40 40
                 return null;
41 41
             }
42 42
 
43 43
             $sender = new TelegramBotHandler($_ENV['APP_LOG_TELEGRAM_KEY'], $_ENV['APP_LOG_TELEGRAM_CHATID']);
44 44
 
45
-            if(isset($context['parse_mode']) && !empty($context['parse_mode'])) {
45
+            if (isset($context['parse_mode']) && !empty($context['parse_mode'])) {
46 46
                 $sender->setParseMode($context['parse_mode']);
47 47
                 unset($context['parse_mode']);
48 48
             } else {
49 49
                 $sender->setParseMode('HTML');
50 50
             }
51
-            if(isset($context['disable_notification']) && $context['disable_notification'] === true) {
51
+            if (isset($context['disable_notification']) && $context['disable_notification'] === true) {
52 52
                 $sender->disableNotification(true);
53 53
                 unset($context['disable_notification']);
54 54
             }
55
-            if(isset($context['disable_preview']) && $context['disable_preview'] === false) {
55
+            if (isset($context['disable_preview']) && $context['disable_preview'] === false) {
56 56
                 $sender->disableWebPagePreview(false);
57 57
                 unset($context['disable_preview']);
58 58
             } else {
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
             $logPath = $_SERVER['DOCUMENT_ROOT'] . ($_ENV['APP_LOG_FOLDER'] ?: '/log/');
73 73
             $logPath .= $channel . '/' . date('Y-m-d') . '.log';
74 74
             $logDir = pathinfo($logPath, PATHINFO_DIRNAME);
75
-            if(!file_exists($logDir)) {
75
+            if (!file_exists($logDir)) {
76 76
                 $mode = 0775;
77
-                if(defined('BX_DIR_PERMISSIONS') && BX_DIR_PERMISSIONS) {
77
+                if (defined('BX_DIR_PERMISSIONS') && BX_DIR_PERMISSIONS) {
78 78
                     $mode = BX_DIR_PERMISSIONS;
79 79
                 }
80 80
                 mkdir($logDir, $mode, true);
Please login to merge, or discard this patch.