Skip to content

Commit 43f879c

Browse files
committed
refactor SmsApiMessage to remove commented code
1 parent 003f3be commit 43f879c

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/Exceptions/MissingPhoneNumberException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ public static function forAnonymousNotifiable(): self
2121
'Make sure you are using Notification::route(\'smsapi\', $phoneNumber) correctly.'
2222
);
2323
}
24-
}
24+
}

src/SmsApiChannel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ private function getPhoneFromAnonymousNotifiable(AnonymousNotifiable $notifiable
8181
{
8282
$routes = $notifiable->routes ?? [];
8383

84-
if (!empty($routes['smsapi'])) {
84+
if (! empty($routes['smsapi'])) {
8585
return $routes['smsapi'];
8686
}
8787

88-
if (!empty($routes['sms'])) {
88+
if (! empty($routes['sms'])) {
8989
return $routes['sms'];
9090
}
9191

@@ -134,7 +134,7 @@ private function applyMessageProperties(SendSmsBag $sms, SmsApiMessage $message)
134134
$properties = [
135135
'encoding', 'test', 'fast', 'normalize', 'noUnicode', 'single',
136136
'notifyUrl', 'expirationDate', 'timeRestriction', 'partnerId',
137-
'checkIdx', 'idx', 'template', 'param1', 'param2', 'param3', 'param4'
137+
'checkIdx', 'idx', 'template', 'param1', 'param2', 'param3', 'param4',
138138
];
139139

140140
foreach ($properties as $property) {
@@ -143,4 +143,4 @@ private function applyMessageProperties(SendSmsBag $sms, SmsApiMessage $message)
143143
}
144144
}
145145
}
146-
}
146+
}

src/SmsApiMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,4 @@ private function withProperty(string $property, mixed $value): self
153153

154154
return new self(...$args);
155155
}
156-
}
156+
}

tests/Feature/RealSmsTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
config(['smsapi.service' => env('SMSAPI_SERVICE')]);
1616
config(['smsapi.from' => env('SMSAPI_FROM')]);
1717

18-
$notification = new class extends Notification {
18+
$notification = new class extends Notification
19+
{
1920
public function via($notifiable): array
2021
{
2122
return ['smsapi'];
@@ -24,8 +25,7 @@ public function via($notifiable): array
2425
public function toSmsApi($notifiable): SmsApiMessage
2526
{
2627
return SmsApiMessage::create('test - ' . now()->format('H:i:s'))
27-
->from('getmed')
28-
->test(true);
28+
->test();
2929
}
3030
};
3131

@@ -38,7 +38,7 @@ public function toSmsApi($notifiable): SmsApiMessage
3838
});
3939

4040
it('can send real sms with confirmation', function () {
41-
if (!env('SEND_REAL_SMS', false)) {
41+
if (! env('SEND_REAL_SMS', false)) {
4242
test()->markTestSkipped('Set SEND_REAL_SMS=true to send real SMS');
4343
}
4444

@@ -50,7 +50,8 @@ public function toSmsApi($notifiable): SmsApiMessage
5050
config(['smsapi.service' => env('SMSAPI_SERVICE')]);
5151
config(['smsapi.from' => env('SMSAPI_FROM')]);
5252

53-
$notification = new class extends Notification {
53+
$notification = new class extends Notification
54+
{
5455
public function via($notifiable): array
5556
{
5657
return ['smsapi'];
@@ -59,7 +60,6 @@ public function via($notifiable): array
5960
public function toSmsApi($notifiable): SmsApiMessage
6061
{
6162
return SmsApiMessage::create('test - ' . now()->format('H:i:s'))
62-
->from('getmed')
6363
->test(false);
6464
}
6565
};
@@ -70,4 +70,4 @@ public function toSmsApi($notifiable): SmsApiMessage
7070
->notify($notification);
7171

7272
expect(true)->toBeTrue();
73-
});
73+
});

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ private function loadEnvironmentVariables(): void
4545
}
4646
}
4747
}
48-
}
48+
}

0 commit comments

Comments
 (0)