Skip to content

Commit d44c274

Browse files
refactor(TelegramBotHandler): switch from if else structure to ternary operator
1 parent 029eb08 commit d44c274

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/TelegramBotHandler.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,9 @@ protected function send(string $message, $option = []): void
9393

9494
$httpClient = new Client($option);
9595

96-
if (strpos($this->botApi, 'https://api.telegram.org') === false) {
97-
$url = $this->botApi;
98-
} else {
99-
$url = $this->botApi . $this->token . '/SendMessage';
100-
}
96+
$url = !str_contains($this->botApi, 'https://api.telegram.org')
97+
? $this->botApi
98+
: $this->botApi . $this->token . '/SendMessage';
10199

102100
$params = [
103101
'text' => $message,

0 commit comments

Comments
 (0)