Passed
Push — master ( bf96b7...274159 )
by Ioannes
01:29
created
src/Monolog/ExceptionHandlerLog.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,20 +35,20 @@
 block discarded – undo
35 35
     {
36 36
         try {
37 37
             $log = new Log();
38
-            if(is_callable($this->context)) {
38
+            if (is_callable($this->context)) {
39 39
                 try {
40 40
                     $context = call_user_func($this->context, $exception);
41
-                } catch(\Exception $e) {
41
+                } catch (\Exception $e) {
42 42
                     self::logInnerException(new \Exception('Can not call ' . $this->context));
43 43
                 }
44 44
             }
45
-            if(!is_array($this->context)) {
45
+            if (!is_array($this->context)) {
46 46
                 $this->context = (!empty($this->context) ? [$this->context] : []);
47 47
             }
48 48
             $this->context['source'] = self::logTypeToString($logType);
49 49
             $log->telegram(LogLevel::CRITICAL, $exception, $this->context);
50 50
 
51
-        } catch(\Exception $e) {
51
+        } catch (\Exception $e) {
52 52
             self::logInnerException($e);
53 53
         }
54 54
     }
Please login to merge, or discard this patch.
src/Monolog/LoggerFactory.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,42 +13,42 @@  discard block
 block discarded – undo
13 13
 
14 14
     public static function getInstance($channel, $context) {
15 15
 
16
-        if(Registry::hasLogger($channel)) {
16
+        if (Registry::hasLogger($channel)) {
17 17
             return Registry::getInstance($channel);
18 18
         }
19 19
 
20
-        if($channel == self::TELEGRAM_CHANNEL) {
20
+        if ($channel == self::TELEGRAM_CHANNEL) {
21 21
 
22 22
             $isEnabled = false;
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_CHANNEL']) || empty($_ENV['APP_LOG_TELEGRAM_CHANNEL'])) {
35
+            if (!isset($_ENV['APP_LOG_TELEGRAM_CHANNEL']) || empty($_ENV['APP_LOG_TELEGRAM_CHANNEL'])) {
36 36
                 return null;
37 37
             }
38 38
 
39 39
             $sender = new TelegramBotHandler($_ENV['APP_LOG_TELEGRAM_KEY'], $_ENV['APP_LOG_TELEGRAM_CHANNEL']);
40 40
 
41
-            if(isset($context['parse_mode']) && !empty($context['parse_mode'])) {
41
+            if (isset($context['parse_mode']) && !empty($context['parse_mode'])) {
42 42
                 $sender->setParseMode($context['parse_mode']);
43 43
                 unset($context['parse_mode']);
44 44
             } else {
45 45
                 $sender->setParseMode('HTML');
46 46
             }
47
-            if(isset($context['disable_notification']) && $context['disable_notification'] === true) {
47
+            if (isset($context['disable_notification']) && $context['disable_notification'] === true) {
48 48
                 $sender->disableNotification(true);
49 49
                 unset($context['disable_notification']);
50 50
             }
51
-            if(isset($context['disable_preview']) && $context['disable_preview'] === false) {
51
+            if (isset($context['disable_preview']) && $context['disable_preview'] === false) {
52 52
                 $sender->disableWebPagePreview(false);
53 53
                 unset($context['disable_preview']);
54 54
             } else {
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
             $logPath = $_SERVER['DOCUMENT_ROOT'] . ($_ENV['APP_LOG_FOLDER'] ?: '/log/');
69 69
             $logPath .= $channel . '/' . date('Y-m-d') . '.log';
70 70
             $logDir = pathinfo($logPath, PATHINFO_DIRNAME);
71
-            if(!file_exists($logDir)) {
71
+            if (!file_exists($logDir)) {
72 72
                 $mode = 0775;
73
-                if(defined('BX_DIR_PERMISSIONS') && BX_DIR_PERMISSIONS) {
73
+                if (defined('BX_DIR_PERMISSIONS') && BX_DIR_PERMISSIONS) {
74 74
                     $mode = BX_DIR_PERMISSIONS;
75 75
                 }
76 76
                 mkdir($logDir, $mode, true);
Please login to merge, or discard this patch.
src/Monolog/FormatHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
      */
10 10
     public static function stringfyMessage($message) {
11 11
 
12
-        if($message instanceof \Throwable) {
12
+        if ($message instanceof \Throwable) {
13 13
             $message = (string) $message;
14
-        } else if(is_array($message) || is_object($message)) {
14
+        } else if (is_array($message) || is_object($message)) {
15 15
             $message = json_encode((array) $message, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
16 16
             $message = str_replace('\\u0000', '', $message);
17 17
         }
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 
28 28
         $source = (isset($context['source']) ? sprintf("<b>%s</b>", (string) $context['source']) : '');
29 29
 
30
-        if($message instanceof \Throwable) {
30
+        if ($message instanceof \Throwable) {
31 31
 
32 32
             $message = sprintf("%s, <i>File: %s</i>", $message->getMessage(), $message->getFile());
33 33
 
34
-        } else if(is_array($message) || is_object($message)) {
34
+        } else if (is_array($message) || is_object($message)) {
35 35
 
36 36
             $message = json_encode((array) $message, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
37 37
             $message = str_replace('\\u0000', '', $message);
38
-            if(strlen($message) > 4000) {
38
+            if (strlen($message) > 4000) {
39 39
                 $message = substr($message, 0, 4000) . '...';
40 40
             }
41 41
             $message = sprintf("<code>%s</code>", $message);
42 42
         }
43 43
 
44
-        if(!empty($source)) {
44
+        if (!empty($source)) {
45 45
             return sprintf("%s: %s", $source, $message);
46 46
         } else {
47 47
             return $message;
Please login to merge, or discard this patch.
src/Log.php 1 patch
Spacing   +3 added lines, -3 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('telegram-messenger', $context);
188 188
 
189
-        if($logger) {
189
+        if ($logger) {
190 190
             $message = FormatHelper::stringfyTelegramMessage($message, (array) $context);
191 191
             $logger->log($level, $message, $context);
192 192
         }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $minDebugLevel = ($_ENV['APP_DEBUG_LEVEL'] ?: LogLevel::DEBUG);
208 208
         $minDebugLevel = Logger::toMonologLevel($minDebugLevel);
209 209
 
210
-        if($level >= $minDebugLevel) {
210
+        if ($level >= $minDebugLevel) {
211 211
             return true;
212 212
         }
213 213
         return false;
Please login to merge, or discard this patch.