Skip to content

Commit 0eb782a

Browse files
committed
styleci fixes
styleci fixes
1 parent 8bc3beb commit 0eb782a

11 files changed

+73
-76
lines changed

build/report.junit.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<testsuites>
3-
<testsuite name="" tests="9" assertions="13" errors="0" warnings="0" failures="0" skipped="0" time="1.167195">
4-
<testsuite name="Unit" tests="6" assertions="9" errors="0" warnings="0" failures="0" skipped="0" time="0.218702">
5-
<testsuite name="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" tests="6" assertions="9" errors="0" warnings="0" failures="0" skipped="0" time="0.218702">
6-
<testcase name="testSmsIsSentViaClickSend" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="22" assertions="1" time="0.217510"/>
7-
<testcase name="testSmsIsSentViaClickSendWithCustomClient" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="47" assertions="2" time="0.000376"/>
8-
<testcase name="testSmsIsSentViaClickSendWithCustomFrom" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="75" assertions="1" time="0.000161"/>
9-
<testcase name="testSmsIsSentViaClickSendWithCustomFromAndClient" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="100" assertions="2" time="0.000275"/>
10-
<testcase name="testSmsIsSentViaClickSendWithCustomFromAndCustomString" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="129" assertions="1" time="0.000183"/>
11-
<testcase name="testSmsIsSentViaClickSendWithCustomClientFromAndClientRef" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="155" assertions="2" time="0.000197"/>
3+
<testsuite name="" tests="9" assertions="13" errors="0" warnings="0" failures="0" skipped="0" time="1.490965">
4+
<testsuite name="Unit" tests="6" assertions="9" errors="0" warnings="0" failures="0" skipped="0" time="0.334244">
5+
<testsuite name="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" tests="6" assertions="9" errors="0" warnings="0" failures="0" skipped="0" time="0.334244">
6+
<testcase name="testSmsIsSentViaClickSend" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="21" assertions="1" time="0.332520"/>
7+
<testcase name="testSmsIsSentViaClickSendWithCustomClient" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="46" assertions="2" time="0.000437"/>
8+
<testcase name="testSmsIsSentViaClickSendWithCustomFrom" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="74" assertions="1" time="0.000163"/>
9+
<testcase name="testSmsIsSentViaClickSendWithCustomFromAndClient" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="99" assertions="2" time="0.000581"/>
10+
<testcase name="testSmsIsSentViaClickSendWithCustomFromAndCustomString" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="128" assertions="1" time="0.000186"/>
11+
<testcase name="testSmsIsSentViaClickSendWithCustomClientFromAndClientRef" class="NotificationChannels\ClickSend\Test\Unit\Channels\ClickSendSmsChannelTest" classname="NotificationChannels.ClickSend.Test.Unit.Channels.ClickSendSmsChannelTest" file="/app/tests/Unit/Channels/ClickSendSmsChannelTest.php" line="154" assertions="2" time="0.000356"/>
1212
</testsuite>
1313
</testsuite>
14-
<testsuite name="Feature" tests="3" assertions="4" errors="0" warnings="0" failures="0" skipped="0" time="0.948493">
15-
<testsuite name="NotificationChannels\ClickSend\Test\Feature\ClientAPICredentialsTest" file="/app/tests/Feature/ClientAPICredentialsTest.php" tests="1" assertions="1" errors="0" warnings="0" failures="0" skipped="0" time="0.869834">
16-
<testcase name="testClientCreatedWithBasicAPICredentials" class="NotificationChannels\ClickSend\Test\Feature\ClientAPICredentialsTest" classname="NotificationChannels.ClickSend.Test.Feature.ClientAPICredentialsTest" file="/app/tests/Feature/ClientAPICredentialsTest.php" line="15" assertions="1" time="0.869834"/>
14+
<testsuite name="Feature" tests="3" assertions="4" errors="0" warnings="0" failures="0" skipped="0" time="1.156721">
15+
<testsuite name="NotificationChannels\ClickSend\Test\Feature\ClientAPICredentialsTest" file="/app/tests/Feature/ClientAPICredentialsTest.php" tests="1" assertions="1" errors="0" warnings="0" failures="0" skipped="0" time="1.054659">
16+
<testcase name="testClientCreatedWithBasicAPICredentials" class="NotificationChannels\ClickSend\Test\Feature\ClientAPICredentialsTest" classname="NotificationChannels.ClickSend.Test.Feature.ClientAPICredentialsTest" file="/app/tests/Feature/ClientAPICredentialsTest.php" line="15" assertions="1" time="1.054659"/>
1717
</testsuite>
18-
<testsuite name="NotificationChannels\ClickSend\Test\Feature\ClientAccountCredentialsTest" file="/app/tests/Feature/ClientAccountCredentialsTest.php" tests="1" assertions="1" errors="0" warnings="0" failures="0" skipped="0" time="0.036415">
19-
<testcase name="testClientCreatedWithBasicAPICredentials" class="NotificationChannels\ClickSend\Test\Feature\ClientAccountCredentialsTest" classname="NotificationChannels.ClickSend.Test.Feature.ClientAccountCredentialsTest" file="/app/tests/Feature/ClientAccountCredentialsTest.php" line="15" assertions="1" time="0.036415"/>
18+
<testsuite name="NotificationChannels\ClickSend\Test\Feature\ClientAccountCredentialsTest" file="/app/tests/Feature/ClientAccountCredentialsTest.php" tests="1" assertions="1" errors="0" warnings="0" failures="0" skipped="0" time="0.058399">
19+
<testcase name="testClientCreatedWithBasicAPICredentials" class="NotificationChannels\ClickSend\Test\Feature\ClientAccountCredentialsTest" classname="NotificationChannels.ClickSend.Test.Feature.ClientAccountCredentialsTest" file="/app/tests/Feature/ClientAccountCredentialsTest.php" line="15" assertions="1" time="0.058399"/>
2020
</testsuite>
21-
<testsuite name="NotificationChannels\ClickSend\Test\Feature\NoClickSendConfigurationTest" file="/app/tests/Feature/NoClickSendConfigurationTest.php" tests="1" assertions="2" errors="0" warnings="0" failures="0" skipped="0" time="0.042244">
22-
<testcase name="testWhenNoConfigurationIsGivenExceptionIsRaised" class="NotificationChannels\ClickSend\Test\Feature\NoClickSendConfigurationTest" classname="NotificationChannels.ClickSend.Test.Feature.NoClickSendConfigurationTest" file="/app/tests/Feature/NoClickSendConfigurationTest.php" line="15" assertions="2" time="0.042244"/>
21+
<testsuite name="NotificationChannels\ClickSend\Test\Feature\NoClickSendConfigurationTest" file="/app/tests/Feature/NoClickSendConfigurationTest.php" tests="1" assertions="2" errors="0" warnings="0" failures="0" skipped="0" time="0.043664">
22+
<testcase name="testWhenNoConfigurationIsGivenExceptionIsRaised" class="NotificationChannels\ClickSend\Test\Feature\NoClickSendConfigurationTest" classname="NotificationChannels.ClickSend.Test.Feature.NoClickSendConfigurationTest" file="/app/tests/Feature/NoClickSendConfigurationTest.php" line="15" assertions="2" time="0.043664"/>
2323
</testsuite>
2424
</testsuite>
2525
</testsuite>

src/ClickSend.php

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

33
namespace NotificationChannels\ClickSend;
44

5-
use Psr\Http\Client\ClientInterface;
65
use ClickSend\Api\SMSApi as Client;
76
use ClickSend\Configuration;
7+
use Psr\Http\Client\ClientInterface;
88
use RuntimeException;
99

1010
class ClickSend
@@ -27,8 +27,7 @@ class ClickSend
2727
* Create a new ClickSend instance.
2828
*
2929
* @param array $config
30-
* @param ClientInterface|null $client
31-
*
30+
* @param ClientInterface|null $client
3231
* @return void
3332
*/
3433
public function __construct(array $config = [], ?ClientInterface $client = null)
@@ -41,8 +40,7 @@ public function __construct(array $config = [], ?ClientInterface $client = null)
4140
* Create a new ClickSend instance.
4241
*
4342
* @param array $config
44-
* @param ClientInterface|null $client
45-
*
43+
* @param ClientInterface|null $client
4644
* @return static
4745
*/
4846
public static function make(array $config, ?ClientInterface $client = null)
@@ -57,15 +55,15 @@ public static function make(array $config, ?ClientInterface $client = null)
5755
*
5856
* @throws \RuntimeException
5957
*/
60-
public function client() : Client
58+
public function client(): Client
6159
{
6260
[$username, $password] = $this->firstComboOrFail([
6361
'apiCredentials' => [
64-
$this->config['api_username'], $this->config['api_key']
62+
$this->config['api_username'], $this->config['api_key'],
6563
],
6664
'accountCredentials' => [
67-
$this->config['account_username'], $this->config['account_password']
68-
]
65+
$this->config['account_username'], $this->config['account_password'],
66+
],
6967
]);
7068

7169
$credentials = Configuration::getDefaultConfiguration()
@@ -78,9 +76,11 @@ public function client() : Client
7876
private function firstComboOrFail(array $combos)
7977
{
8078
$credentials = collect($combos)
81-
->first( function($pair) { return ! in_array(null, $pair,true); });
79+
->first(function ($pair) {
80+
return ! in_array(null, $pair, true);
81+
});
8282

83-
if(! $credentials) {
83+
if (! $credentials) {
8484
throw new RuntimeException('Please provide your ClickSend API credentials.
8585
Possible combinations: api_username + api_key OR account_username + account_password.');
8686
}

src/ClickSendChannel.php

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

33
namespace NotificationChannels\ClickSend;
44

5-
use NotificationChannels\ClickSend\Exceptions\CouldNotSendNotification;
65
use ClickSend\Api\SMSApi as ClickSendClient;
7-
use Illuminate\Notifications\Notification;
8-
use ClickSend\Model\SmsMessageCollection;
9-
use ClickSend\Model\SmsMessage;
106
use ClickSend\ApiException;
7+
use ClickSend\Model\SmsMessage;
8+
use ClickSend\Model\SmsMessageCollection;
9+
use Illuminate\Notifications\Notification;
10+
use NotificationChannels\ClickSend\Exceptions\CouldNotSendNotification;
1111

1212
class ClickSendChannel
1313
{
@@ -28,9 +28,8 @@ class ClickSendChannel
2828
/**
2929
* Create a new ClickSend channel instance.
3030
*
31-
* @param ClickSendClient $client
32-
* @param string $from
33-
*
31+
* @param ClickSendClient $client
32+
* @param string $from
3433
* @return void
3534
*/
3635
public function __construct(ClickSendClient $client, $from)
@@ -43,7 +42,7 @@ public function __construct(ClickSendClient $client, $from)
4342
* Send the given notification.
4443
*
4544
* @param mixed $notifiable
46-
* @param Notification $notification
45+
* @param Notification $notification
4746
* @return mixed
4847
*/
4948
public function send($notifiable, Notification $notification): void
@@ -64,15 +63,14 @@ public function send($notifiable, Notification $notification): void
6463
'body' => trim($message->content),
6564
'from' => $message->from ?: $this->from,
6665
'source' => 'laravel',
67-
'custom_string' => $message->reference
68-
])
66+
'custom_string' => $message->reference,
67+
]),
6968
]);
7069

7170
try {
72-
( $message->client ?? $this->client )->smsSendPost( $sms_messages );
73-
}
74-
catch (ApiException $e) {
71+
($message->client ?? $this->client)->smsSendPost($sms_messages);
72+
} catch (ApiException $e) {
7573
throw CouldNotSendNotification::ClickSendApiException($e);
76-
};
74+
}
7775
}
7876
}

src/ClickSendMessage.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ClickSendMessage
4444
/**
4545
* Create a new message instance.
4646
*
47-
* @param string $content
47+
* @param string $content
4848
* @return void
4949
*/
5050
public function __construct($content = '')
@@ -55,7 +55,7 @@ public function __construct($content = '')
5555
/**
5656
* Set the message content.
5757
*
58-
* @param string $content
58+
* @param string $content
5959
* @return ClickSendMessage
6060
*/
6161
public function content($content)
@@ -68,7 +68,7 @@ public function content($content)
6868
/**
6969
* Set the phone number the message should be sent from.
7070
*
71-
* @param string $from
71+
* @param string $from
7272
* @return $this
7373
*/
7474
public function from($from)
@@ -81,7 +81,7 @@ public function from($from)
8181
/**
8282
* Set the client reference (up to 40 characters).
8383
*
84-
* @param string $string
84+
* @param string $string
8585
* @return $this
8686
*/
8787
public function reference($string)
@@ -91,16 +91,16 @@ public function reference($string)
9191
return $this;
9292
}
9393

94-
9594
/**
9695
* Set the ClickSend SMS client instance.
9796
*
98-
* @param SMSApi $client
97+
* @param SMSApi $client
9998
* @return $this
10099
*/
101100
public function usingClient($client)
102101
{
103102
$this->client = $client;
104103

105104
return $this;
106-
}}
105+
}
106+
}

src/ClickSendServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace NotificationChannels\ClickSend;
44

5+
use ClickSend\Api\SMSApi as Client;
56
use Illuminate\Notifications\ChannelManager;
67
use Illuminate\Support\Facades\Notification;
78
use Illuminate\Support\ServiceProvider;
8-
use ClickSend\Api\SMSApi as Client;
99
use RuntimeException;
1010

1111
class ClickSendServiceProvider extends ServiceProvider

src/Exceptions/CouldNotSendNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class CouldNotSendNotification extends \Exception
99
public static function ClickSendApiException(ApiException $exception): self
1010
{
1111
return new static(
12-
"ClickSend could not send and responded with an error.", null, $exception
12+
'ClickSend could not send and responded with an error.', null, $exception
1313
);
1414
}
1515
}

src/Facades/ClickSend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ClickSend extends Facade
1212
*
1313
* @return string
1414
*/
15-
protected static function getFacadeAccessor() : string
15+
protected static function getFacadeAccessor(): string
1616
{
1717
return Client::class;
1818
}

tests/Feature/ClientAPICredentialsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testClientCreatedWithBasicAPICredentials()
1616
{
1717
$credentials = $this->app->make(Client::class)->getConfig();
1818

19-
$this->assertEquals([ 'my_username', 'my_api_key' ],
20-
[ $credentials->getUsername(), $credentials->getPassword() ]);
19+
$this->assertEquals(['my_username', 'my_api_key'],
20+
[$credentials->getUsername(), $credentials->getPassword()]);
2121
}
2222
}

tests/Feature/ClientAccountCredentialsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testClientCreatedWithBasicAPICredentials()
1616
{
1717
$credentials = $this->app->make(Client::class)->getConfig();
1818

19-
$this->assertEquals([ 'my_username', 'my_account_password' ],
20-
[ $credentials->getUsername(), $credentials->getPassword() ]);
19+
$this->assertEquals(['my_username', 'my_account_password'],
20+
[$credentials->getUsername(), $credentials->getPassword()]);
2121
}
2222
}

tests/Feature/NoClickSendConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected function getEnvironmentSetUp($app)
1515
public function testWhenNoConfigurationIsGivenExceptionIsRaised()
1616
{
1717
$this->expectException(RuntimeException::class);
18-
$this->expectExceptionMessage( 'Please provide your ClickSend API credentials.
18+
$this->expectExceptionMessage('Please provide your ClickSend API credentials.
1919
Possible combinations: api_username + api_key OR account_username + account_password.');
2020
app(Client::class);
2121
}

tests/Unit/Channels/ClickSendSmsChannelTest.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
namespace NotificationChannels\ClickSend\Test\Unit\Channels;
44

5-
use ClickSend\Api\SMSApi;
5+
use ClickSend\Api\SMSApi as Client;
6+
use ClickSend\Model\SmsMessage as SMS;
7+
use ClickSend\Model\SmsMessageCollection;
8+
use Hamcrest\Core\IsEqual;
9+
use Illuminate\Notifications\Notifiable;
10+
use Illuminate\Notifications\Notification;
611
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
12+
use Mockery as m;
713
use NotificationChannels\ClickSend\ClickSendChannel;
814
use NotificationChannels\ClickSend\ClickSendMessage;
9-
use Illuminate\Notifications\Notification;
10-
use ClickSend\Model\SmsMessageCollection;
11-
use Illuminate\Notifications\Notifiable;
12-
use ClickSend\Model\SmsMessage as SMS;
13-
use ClickSend\Api\SMSApi as Client;
1415
use PHPUnit\Framework\TestCase;
15-
use Hamcrest\Core\IsEqual;
16-
use Mockery as m;
1716

1817
class ClickSendSmsChannelTest extends TestCase
1918
{
@@ -33,8 +32,8 @@ public function testSmsIsSentViaClickSend()
3332
'to' => '5555555555',
3433
'from' =>'4444444444',
3534
'body' => 'this is my message',
36-
'source' => 'laravel'
37-
])
35+
'source' => 'laravel',
36+
]),
3837
]);
3938

4039
$clickSend->shouldReceive('smsSendPost')
@@ -51,8 +50,8 @@ public function testSmsIsSentViaClickSendWithCustomClient()
5150
'to' => '5555555555',
5251
'from' =>'4444444444',
5352
'body' => 'this is my message',
54-
'source' => 'laravel'
55-
])
53+
'source' => 'laravel',
54+
]),
5655
]);
5756

5857
$customClickSend = m::mock(Client::class);
@@ -86,8 +85,8 @@ public function testSmsIsSentViaClickSendWithCustomFrom()
8685
'to' => '5555555555',
8786
'from' =>'5554443333',
8887
'body' => 'this is my message',
89-
'source' => 'laravel'
90-
])
88+
'source' => 'laravel',
89+
]),
9190
]);
9291

9392
$clickSend->shouldReceive('smsSendPost')
@@ -106,8 +105,8 @@ public function testSmsIsSentViaClickSendWithCustomFromAndClient()
106105
'to' => '5555555555',
107106
'from' =>'5554443333',
108107
'body' => 'this is my message',
109-
'source' => 'laravel'
110-
])
108+
'source' => 'laravel',
109+
]),
111110
]);
112111

113112
$customClickSend->shouldReceive('smsSendPost')
@@ -141,8 +140,8 @@ public function testSmsIsSentViaClickSendWithCustomFromAndCustomString()
141140
'from' =>'5554443333',
142141
'body' => 'this is my message',
143142
'source' => 'laravel',
144-
'custom_string' => '11'
145-
])
143+
'custom_string' => '11',
144+
]),
146145
]);
147146

148147
$clickSend->shouldReceive('smsSendPost')
@@ -162,8 +161,8 @@ public function testSmsIsSentViaClickSendWithCustomClientFromAndClientRef()
162161
'from' =>'5554443333',
163162
'body' => 'this is my message',
164163
'source' => 'laravel',
165-
'custom_string' => '11'
166-
])
164+
'custom_string' => '11',
165+
]),
167166
]);
168167

169168
$customClickSend->shouldReceive('smsSendPost')

0 commit comments

Comments
 (0)