22
33namespace NotificationChannels \Telegram ;
44
5+ use Illuminate \Support \Facades \View ;
56use NotificationChannels \Telegram \Contracts \TelegramSenderContract ;
67use NotificationChannels \Telegram \Enums \FileType ;
78use NotificationChannels \Telegram \Enums \ParseMode ;
89use NotificationChannels \Telegram \Exceptions \CouldNotSendNotification ;
910use Psr \Http \Message \ResponseInterface ;
1011use Psr \Http \Message \StreamInterface ;
11- use Illuminate \Support \Facades \View ;
1212
1313/**
1414 * Class TelegramFile
@@ -24,7 +24,7 @@ class TelegramFile extends TelegramBase implements TelegramSenderContract
2424 /** @var array File types that don't support captions */
2525 protected array $ captionUnsupportedTypes = [
2626 FileType::VideoNote,
27- FileType::Sticker
27+ FileType::Sticker,
2828 ];
2929
3030 /**
@@ -58,9 +58,10 @@ public function content(string $content): self
5858 /**
5959 * Attach a file to the message.
6060 *
61- * @param resource|StreamInterface|string $file The file content or path
62- * @param FileType|string $type The file type
63- * @param string|null $filename Optional custom filename
61+ * @param resource|StreamInterface|string $file The file content or path
62+ * @param FileType|string $type The file type
63+ * @param string|null $filename Optional custom filename
64+ *
6465 * @throws CouldNotSendNotification
6566 */
6667 public function file (mixed $ file , FileType |string $ type , ?string $ filename = null ): self
@@ -69,8 +70,8 @@ public function file(mixed $file, FileType|string $type, ?string $filename = nul
6970 $ typeValue = $ this ->type ->value ;
7071
7172 // Handle file URLs or Telegram file IDs
72- if (is_string ($ file ) && !$ this ->isReadableFile ($ file ) && $ filename === null ) {
73- if (!filter_var ($ file , FILTER_VALIDATE_URL ) && !preg_match ('/^[a-zA-Z0-9_-]+$/ ' , $ file )) {
73+ if (is_string ($ file ) && ! $ this ->isReadableFile ($ file ) && $ filename === null ) {
74+ if (! filter_var ($ file , FILTER_VALIDATE_URL ) && ! preg_match ('/^[a-zA-Z0-9_-]+$/ ' , $ file )) {
7475 throw CouldNotSendNotification::invalidFileIdentifier ($ file );
7576 }
7677
@@ -185,7 +186,7 @@ public function hasFile(): bool
185186 */
186187 protected function supportsCaptions (): bool
187188 {
188- return !in_array ($ this ->type , $ this ->captionUnsupportedTypes );
189+ return ! in_array ($ this ->type , $ this ->captionUnsupportedTypes );
189190 }
190191
191192 /**
@@ -196,7 +197,7 @@ public function toArray(): array
196197 $ payload = $ this ->payload ;
197198
198199 // Remove caption for unsupported file types
199- if (!$ this ->supportsCaptions () && isset ($ payload ['caption ' ])) {
200+ if (! $ this ->supportsCaptions () && isset ($ payload ['caption ' ])) {
200201 unset($ payload ['caption ' ]);
201202 }
202203
0 commit comments