@@ -13,41 +13,41 @@ discard block |
||
| 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 | - if(isset($_ENV['APP_LOG_TELEGRAM'])) { |
|
| 22 | + if (isset($_ENV['APP_LOG_TELEGRAM'])) { |
|
| 23 | 23 | $APP_LOG_TELEGRAM = trim(strtolower($_ENV['APP_LOG_TELEGRAM'])); |
| 24 | - if($APP_LOG_TELEGRAM !== 'on' && $APP_LOG_TELEGRAM !== 'true' && $APP_LOG_TELEGRAM !== '1') { |
|
| 24 | + if ($APP_LOG_TELEGRAM !== 'on' && $APP_LOG_TELEGRAM !== 'true' && $APP_LOG_TELEGRAM !== '1') { |
|
| 25 | 25 | return null; |
| 26 | 26 | } |
| 27 | 27 | } else { |
| 28 | 28 | return null; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if(!isset($_ENV['APP_LOG_TELEGRAM_KEY']) || empty($_ENV['APP_LOG_TELEGRAM_KEY'])) { |
|
| 31 | + if (!isset($_ENV['APP_LOG_TELEGRAM_KEY']) || empty($_ENV['APP_LOG_TELEGRAM_KEY'])) { |
|
| 32 | 32 | return null; |
| 33 | 33 | } |
| 34 | - if(!isset($_ENV['APP_LOG_TELEGRAM_CHANNEL']) || empty($_ENV['APP_LOG_TELEGRAM_CHANNEL'])) { |
|
| 34 | + if (!isset($_ENV['APP_LOG_TELEGRAM_CHANNEL']) || empty($_ENV['APP_LOG_TELEGRAM_CHANNEL'])) { |
|
| 35 | 35 | return null; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $sender = new TelegramBotHandler($_ENV['APP_LOG_TELEGRAM_KEY'], $_ENV['APP_LOG_TELEGRAM_CHANNEL']); |
| 39 | 39 | |
| 40 | - if(isset($context['parse_mode']) && !empty($context['parse_mode'])) { |
|
| 40 | + if (isset($context['parse_mode']) && !empty($context['parse_mode'])) { |
|
| 41 | 41 | $sender->setParseMode($context['parse_mode']); |
| 42 | 42 | unset($context['parse_mode']); |
| 43 | 43 | } else { |
| 44 | 44 | $sender->setParseMode('HTML'); |
| 45 | 45 | } |
| 46 | - if(isset($context['disable_notification']) && $context['disable_notification'] === true) { |
|
| 46 | + if (isset($context['disable_notification']) && $context['disable_notification'] === true) { |
|
| 47 | 47 | $sender->disableNotification(true); |
| 48 | 48 | unset($context['disable_notification']); |
| 49 | 49 | } |
| 50 | - if(isset($context['disable_preview']) && $context['disable_preview'] === false) { |
|
| 50 | + if (isset($context['disable_preview']) && $context['disable_preview'] === false) { |
|
| 51 | 51 | $sender->disableWebPagePreview(false); |
| 52 | 52 | unset($context['disable_preview']); |
| 53 | 53 | } else { |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | $logPath = $_SERVER['DOCUMENT_ROOT'] . ($_ENV['APP_LOG_FOLDER'] ?: '/log/'); |
| 68 | 68 | $logPath .= $channel . '/' . date('Y-m-d') . '.log'; |
| 69 | 69 | $logDir = pathinfo($logPath, PATHINFO_DIRNAME); |
| 70 | - if(!file_exists($logDir)) { |
|
| 70 | + if (!file_exists($logDir)) { |
|
| 71 | 71 | $mode = 0775; |
| 72 | - if(defined('BX_DIR_PERMISSIONS') && BX_DIR_PERMISSIONS) { |
|
| 72 | + if (defined('BX_DIR_PERMISSIONS') && BX_DIR_PERMISSIONS) { |
|
| 73 | 73 | $mode = BX_DIR_PERMISSIONS; |
| 74 | 74 | } |
| 75 | 75 | mkdir($logDir, $mode, true); |