Skip to content

Commit 2409b6f

Browse files
committed
Update TextlocalChannel.php
1 parent 1ae7cf2 commit 2409b6f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/TextlocalChannel.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@
1414
*/
1515
class TextlocalChannel
1616
{
17-
private $client;
1817
private $sender;
1918

2019
/**
2120
* creates a textlocal channel object by using the configs
2221
*
2322
* @param Textlocal $client
2423
*/
25-
public function __construct(Textlocal $client)
24+
public function __construct(private Textlocal $client)
2625
{
27-
$this->client = $client;
2826
$this->sender = config('textlocal.sender');
2927
}
3028

@@ -87,13 +85,21 @@ public function getClient($notifiable, Notification $notification)
8785

8886
if ($notifiable instanceof IUsesTextlocalClientConfig) {
8987

90-
[$username, $hash, $apiKey, $country] = $notification->getTextlocalClientConfig($notification);
88+
if (! $notifiable->shouldUseCustomTextlocalConfig($notification)) {
89+
return $client;
90+
}
91+
92+
[$username, $hash, $apiKey, $country] = $notifiable->getTextlocalClientConfig($notification);
9193

9294
$client = new Textlocal($username, $hash, $apiKey, $country);
9395
}
9496

9597
if ($notification instanceof INotificationUsesTextlocalClientConfig) {
9698

99+
if (! $notification->shouldUseCustomTextlocalConfig($notification)) {
100+
return $client;
101+
}
102+
97103
[$username, $hash, $apiKey, $country] = $notification->getTextlocalClientConfig($notifiable);
98104

99105
$client = new Textlocal($username, $hash, $apiKey, $country);

0 commit comments

Comments
 (0)