Skip to content

Commit 22f3e99

Browse files
authored
Merge pull request #1 from xefi/feature/style-ci-config
Feature/style ci config
2 parents f30758e + ac28d61 commit 22f3e99

File tree

7 files changed

+59
-58
lines changed

7 files changed

+59
-58
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
tests:
13-
runs-on: ubuntu-23.10
13+
runs-on: ubuntu-22.04
1414

1515
strategy:
1616
fail-fast: true

.styleci.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/sms-factor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
*/
2626

2727
'api_token' => env('SMS_FACTOR_TOKEN'),
28-
];
28+
];

src/Channels/SmsFactorSmsChannel.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
namespace Xefi\SmsFactor\Channels;
44

5-
use Xefi\SmsFactor\Messages\SmsFactorMessage;
6-
use SMSFactor\Message;
75
use Illuminate\Notifications\Notification;
6+
use SMSFactor\Message;
7+
use Xefi\SmsFactor\Messages\SmsFactorMessage;
88

99
class SmsFactorSmsChannel extends Notification
1010
{
1111
/**
1212
* Send the given notification.
1313
*
14-
* @param mixed $notifiable
15-
* @param \Illuminate\Notifications\Notification $notification
14+
* @param mixed $notifiable
15+
* @param \Illuminate\Notifications\Notification $notification
16+
*
1617
* @return \SmsFactor\ApiResponse
1718
*/
1819
public function send($notifiable, Notification $notification)
1920
{
20-
if (! $to = $notifiable->routeNotificationFor('sms-factor', $notification)) {
21+
if (!$to = $notifiable->routeNotificationFor('sms-factor', $notification)) {
2122
return;
2223
}
2324

@@ -28,12 +29,12 @@ public function send($notifiable, Notification $notification)
2829
}
2930

3031
return Message::send([
31-
'to' => $to,
32-
'text' => trim($message->text),
33-
'delay' => $message->delay,
32+
'to' => $to,
33+
'text' => trim($message->text),
34+
'delay' => $message->delay,
3435
'pushtype' => $message->pushtype ?? null,
35-
'sender' => $message->sender ?? config('sms-factor.sms_from'),
36+
'sender' => $message->sender ?? config('sms-factor.sms_from'),
3637
'gsmsmsid' => $message->gsmsmsid ?? null,
3738
]);
3839
}
39-
}
40+
}

src/Messages/SmsFactorMessage.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class SmsFactorMessage
4444
/**
4545
* Set the message text.
4646
*
47-
* @param string $text
47+
* @param string $text
48+
*
4849
* @return $this
4950
*/
5051
public function text($text)
@@ -57,7 +58,8 @@ public function text($text)
5758
/**
5859
* Set the message pushtype.
5960
*
60-
* @param string $pushtype
61+
* @param string $pushtype
62+
*
6163
* @return $this
6264
*/
6365
public function pushtype($pushtype)
@@ -70,7 +72,8 @@ public function pushtype($pushtype)
7072
/**
7173
* Set the message delay.
7274
*
73-
* @param \Carbon\Carbon $delay
75+
* @param \Carbon\Carbon $delay
76+
*
7477
* @return $this
7578
*/
7679
public function delay($delay)
@@ -87,7 +90,8 @@ public function delay($delay)
8790
/**
8891
* Set the message sender.
8992
*
90-
* @param string $sender
93+
* @param string $sender
94+
*
9195
* @return $this
9296
*/
9397
public function sender($sender)
@@ -100,7 +104,8 @@ public function sender($sender)
100104
/**
101105
* Set the message gsmsmsid.
102106
*
103-
* @param string $gsmsmsid
107+
* @param string $gsmsmsid
108+
*
104109
* @return $this
105110
*/
106111
public function gsmsmsid($gsmsmsid)
@@ -109,4 +114,4 @@ public function gsmsmsid($gsmsmsid)
109114

110115
return $this;
111116
}
112-
}
117+
}

src/SmsFactorChannelServiceProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Xefi\SmsFactor;
44

5+
use Illuminate\Notifications\ChannelManager;
6+
use Illuminate\Support\Facades\Notification;
57
use Illuminate\Support\ServiceProvider;
68
use Xefi\SmsFactor\Channels\SmsFactorSmsChannel;
7-
use Illuminate\Support\Facades\Notification;
8-
use Illuminate\Notifications\ChannelManager;
99

1010
class SmsFactorChannelServiceProvider extends ServiceProvider
1111
{
@@ -16,7 +16,7 @@ class SmsFactorChannelServiceProvider extends ServiceProvider
1616
*/
1717
public function register()
1818
{
19-
$this->mergeConfigFrom(__DIR__ . '/../config/sms-factor.php', 'sms-factor');
19+
$this->mergeConfigFrom(__DIR__.'/../config/sms-factor.php', 'sms-factor');
2020

2121
Notification::resolved(function (ChannelManager $service) {
2222
$service->extend('sms-factor', function ($app) {
@@ -40,4 +40,4 @@ public function boot()
4040
], 'sms-factor');
4141
}
4242
}
43-
}
43+
}

tests/Unit/Channels/SmsFactorSmsChannelTest.php

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use SMSFactor\SMSFactor;
1212
use Xefi\SmsFactor\Channels\SmsFactorSmsChannel;
1313
use Xefi\SmsFactor\Messages\SmsFactorMessage;
14-
use Xefi\SmsFactor\SmsFactorChannelServiceProvider;
1514

1615
class SmsFactorSmsChannelTest extends TestCase
1716
{
@@ -24,20 +23,20 @@ protected function setUp(): void
2423

2524
public function testSmsIsSentViaSmsFactor()
2625
{
27-
$notification = new NotificationSmsFactorSmsChannelTestNotification;
28-
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable;
26+
$notification = new NotificationSmsFactorSmsChannelTestNotification();
27+
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable();
2928

3029
$channel = new SmsFactorSmsChannel();
3130

3231
$this->mock('alias:'.Message::class, function (MockInterface $mock) {
3332
$mock->shouldReceive('send')
3433
->with(
3534
[
36-
'to' => '5555555555',
37-
'text' => 'this is my message',
38-
'delay' => null,
35+
'to' => '5555555555',
36+
'text' => 'this is my message',
37+
'delay' => null,
3938
'pushtype' => null,
40-
'sender' => null,
39+
'sender' => null,
4140
'gsmsmsid' => null,
4241
]
4342
)
@@ -49,20 +48,20 @@ public function testSmsIsSentViaSmsFactor()
4948

5049
public function testSmsIsSentViaSmsFactorWithCustomSender()
5150
{
52-
$notification = new NotificationSmsFactorSmsChannelTestCustomSenderNotification;
53-
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable;
51+
$notification = new NotificationSmsFactorSmsChannelTestCustomSenderNotification();
52+
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable();
5453

5554
$channel = new SmsFactorSmsChannel();
5655

5756
$this->mock('alias:'.Message::class, function (MockInterface $mock) {
5857
$mock->shouldReceive('send')
5958
->with(
6059
[
61-
'to' => '5555555555',
62-
'text' => 'this is my message',
63-
'delay' => null,
60+
'to' => '5555555555',
61+
'text' => 'this is my message',
62+
'delay' => null,
6463
'pushtype' => null,
65-
'sender' => '12345',
64+
'sender' => '12345',
6665
'gsmsmsid' => null,
6766
]
6867
)
@@ -74,20 +73,20 @@ public function testSmsIsSentViaSmsFactorWithCustomSender()
7473

7574
public function testSmsIsSentViaSmsFactorWithCustomDelay()
7675
{
77-
$notification = new NotificationSmsFactorSmsChannelTestCustomDelayNotification;
78-
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable;
76+
$notification = new NotificationSmsFactorSmsChannelTestCustomDelayNotification();
77+
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable();
7978

8079
$channel = new SmsFactorSmsChannel();
8180

8281
$this->mock('alias:'.Message::class, function (MockInterface $mock) {
8382
$mock->shouldReceive('send')
8483
->with(
8584
[
86-
'to' => '5555555555',
87-
'text' => 'this is my message',
88-
'delay' => Carbon::create(2024, 01, 01)->format('Y-m-d H:i:s'),
85+
'to' => '5555555555',
86+
'text' => 'this is my message',
87+
'delay' => Carbon::create(2024, 01, 01)->format('Y-m-d H:i:s'),
8988
'pushtype' => null,
90-
'sender' => null,
89+
'sender' => null,
9190
'gsmsmsid' => null,
9291
]
9392
)
@@ -99,20 +98,20 @@ public function testSmsIsSentViaSmsFactorWithCustomDelay()
9998

10099
public function testSmsIsSentViaSmsFactorWithCustomPushType()
101100
{
102-
$notification = new NotificationSmsFactorSmsChannelTestCustomPushTypeNotification;
103-
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable;
101+
$notification = new NotificationSmsFactorSmsChannelTestCustomPushTypeNotification();
102+
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable();
104103

105104
$channel = new SmsFactorSmsChannel();
106105

107106
$this->mock('alias:'.Message::class, function (MockInterface $mock) {
108107
$mock->shouldReceive('send')
109108
->with(
110109
[
111-
'to' => '5555555555',
112-
'text' => 'this is my message',
113-
'delay' => null,
110+
'to' => '5555555555',
111+
'text' => 'this is my message',
112+
'delay' => null,
114113
'pushtype' => 'alert',
115-
'sender' => null,
114+
'sender' => null,
116115
'gsmsmsid' => null,
117116
]
118117
)
@@ -124,20 +123,20 @@ public function testSmsIsSentViaSmsFactorWithCustomPushType()
124123

125124
public function testSmsIsSentViaSmsFactorWithCustomGsmsmsid()
126125
{
127-
$notification = new NotificationSmsFactorSmsChannelTestCustomGsmsmsidNotification;
128-
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable;
126+
$notification = new NotificationSmsFactorSmsChannelTestCustomGsmsmsidNotification();
127+
$notifiable = new NotificationSmsFactorSmsChannelTestNotifiable();
129128

130129
$channel = new SmsFactorSmsChannel();
131130

132131
$this->mock('alias:'.Message::class, function (MockInterface $mock) {
133132
$mock->shouldReceive('send')
134133
->with(
135134
[
136-
'to' => '5555555555',
137-
'text' => 'this is my message',
138-
'delay' => null,
135+
'to' => '5555555555',
136+
'text' => 'this is my message',
137+
'delay' => null,
139138
'pushtype' => null,
140-
'sender' => null,
139+
'sender' => null,
141140
'gsmsmsid' => 'my-custom-id',
142141
]
143142
)
@@ -198,4 +197,4 @@ public function routeNotificationForSmsFactor($notification)
198197
{
199198
return $this->phone_number;
200199
}
201-
}
200+
}

0 commit comments

Comments
 (0)