Skip to content

Commit 095fb6d

Browse files
committed
Drop 8.1. Refactor Telegram Class.
1 parent e3c4769 commit 095fb6d

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: true
1717
matrix:
18-
php: ['8.1', '8.2', '8.3']
18+
php: ['8.2', '8.3']
1919
dependencies: [lowest, highest]
2020
experimental: [false]
2121

src/Telegram.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,14 @@
1414
*/
1515
class Telegram
1616
{
17-
/** @var HttpClient HTTP Client */
18-
protected readonly HttpClient $http;
19-
20-
/** @var null|string Telegram Bot API Token. */
21-
protected ?string $token;
22-
2317
/** @var string Telegram Bot API Base URI */
2418
protected string $apiBaseUri;
2519

2620
public function __construct(
27-
?string $token = null,
28-
HttpClient $httpClient = new HttpClient,
21+
protected ?string $token = null,
22+
protected HttpClient $http = new HttpClient,
2923
string $apiBaseUri = 'https://api.telegram.org'
3024
) {
31-
$this->token = $token;
32-
$this->http = $httpClient;
3325
$this->setApiBaseUri($apiBaseUri);
3426
}
3527

@@ -115,9 +107,9 @@ public function sendMessage(array $params): ?ResponseInterface
115107
*
116108
* @throws CouldNotSendNotification
117109
*/
118-
public function sendFile(array $params, string|array $type, bool $multipart = false): ?ResponseInterface
110+
public function sendFile(array $params, string $type, bool $multipart = false): ?ResponseInterface
119111
{
120-
return $this->sendRequest('send'.Str::studly((array) $type[0]), $params, $multipart);
112+
return $this->sendRequest('send'.Str::studly($type), $params, $multipart);
121113
}
122114

123115
/**

0 commit comments

Comments
 (0)