Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklul committed Nov 21, 2023
1 parent 6dea395 commit 0dad372
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/TelegramFormatter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* This file is part of the Monolog Telegram Handler package.
*
Expand Down Expand Up @@ -46,15 +47,15 @@ class TelegramFormatter implements FormatterInterface
* @var array
*/
private $emojis = [
'DEBUG' => '🐞',
'INFO' => 'ℹ️',
'NOTICE' => '📌',
'WARNING' => '⚠️',
'ERROR' => '',
'CRITICAL' => '💀',
'ALERT' => '🛎️',
'DEBUG' => '🐞',
'INFO' => 'ℹ️',
'NOTICE' => '📌',
'WARNING' => '⚠️',
'ERROR' => '',
'CRITICAL' => '💀',
'ALERT' => '🛎️',
'EMERGENCY' => '🚨',
];
];

/**
* Formatter constructor
Expand All @@ -71,7 +72,7 @@ public function __construct(bool $html = true, string $format = null, string $da
$this->format = $format ?: self::MESSAGE_FORMAT;
$this->dateFormat = $dateFormat ?: self::DATE_FORMAT;
$this->separator = $separator;
$emojiArray != null && $this->emojis = $emojiArray;
$emojiArray !== null && $this->emojis = $emojiArray;
}

/**
Expand Down Expand Up @@ -102,7 +103,7 @@ public function format(LogRecord $record): string
$message = str_replace('%extra%', '', $message);
}

$emoji = $this->emojis[$record['level_name']] ?? $this->emojis['DEFAULT'] ?? '🐞';
$emoji = $this->emojis[$record['level_name']] ?? $this->emojis['DEFAULT'] ?? '🐞';

/** @param \DateTimeImmutable $record['datetime'] */
$message = str_replace(['%emoji%', '%level_name%', '%channel%', '%date%'], [$emoji, $record['level_name'], $record['channel'], $record['datetime']->format($this->dateFormat)], $message);
Expand Down

0 comments on commit 0dad372

Please sign in to comment.