Skip to content

Commit 4216d92

Browse files
committed
Merge branch 'v3' of github.com:laravel-notification-channels/cmsms into v3
2 parents b314d0f + cbb787d commit 4216d92

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
"illuminate/support": "^9.0"
2020
},
2121
"require-dev": {
22+
"friendsofphp/php-cs-fixer": "^3.6",
2223
"mockery/mockery": "^1.5",
23-
"phpunit/phpunit": "^9.5",
24-
"orchestra/testbench": "^7.0"
24+
"orchestra/testbench": "^7.0",
25+
"phpunit/phpunit": "^9.5"
2526
},
2627
"config": {
2728
"sort-packages": true
@@ -46,6 +47,8 @@
4647
"minimum-stability": "dev",
4748
"prefer-stable": true,
4849
"scripts": {
49-
"test": "vendor/bin/phpunit"
50+
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
51+
"test": "vendor/bin/phpunit",
52+
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
5053
}
5154
}

src/CmsmsChannel.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ class CmsmsChannel
1010
{
1111
public function __construct(
1212
protected CmsmsClient $client,
13-
)
14-
{
13+
) {
1514
}
1615

1716
public function send($notifiable, Notification $notification): void
1817
{
19-
if (!$recipient = $notifiable->routeNotificationFor('Cmsms')) {
18+
if (! $recipient = $notifiable->routeNotificationFor('Cmsms')) {
2019
return;
2120
}
2221

src/CmsmsClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class CmsmsClient
1616
public function __construct(
1717
protected GuzzleClient $client,
1818
protected string $productToken,
19-
) {
19+
) {
2020
}
2121

2222
public function send(CmsmsMessage $message, string $recipient): void
@@ -26,7 +26,7 @@ public function send(CmsmsMessage $message, string $recipient): void
2626
}
2727

2828
$response = $this->client->request('POST', static::GATEWAY_URL, [
29-
'body' => $this->buildMessageXml($message, $recipient),
29+
'body' => $this->buildMessageXml($message, $recipient),
3030
'headers' => [
3131
'Content-Type' => 'application/xml',
3232
],
@@ -35,7 +35,7 @@ public function send(CmsmsMessage $message, string $recipient): void
3535
// API returns an empty string on success
3636
// On failure, only the error string is passed
3737
$body = $response->getBody()->getContents();
38-
if (!empty($body)) {
38+
if (! empty($body)) {
3939
throw CouldNotSendNotification::serviceRespondedWithAnError($body);
4040
}
4141
}

src/CmsmsMessage.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class CmsmsMessage
2020

2121
private function __construct(
2222
protected string $body = ''
23-
)
24-
{
23+
) {
2524
$this->body($body);
2625
}
2726

@@ -45,7 +44,7 @@ public function originator(string|int $originator): self
4544

4645
public function reference(string $reference): self
4746
{
48-
if (empty($reference) || strlen($reference) > 32 || !ctype_alnum($reference)) {
47+
if (empty($reference) || strlen($reference) > 32 || ! ctype_alnum($reference)) {
4948
throw InvalidMessage::invalidReference($reference);
5049
}
5150

@@ -81,9 +80,9 @@ public function multipart(int $minimum, int $maximum): self
8180
public function toXmlArray(): array
8281
{
8382
return array_filter([
84-
'BODY' => $this->body,
85-
'FROM' => $this->originator,
86-
'REFERENCE' => $this->reference,
83+
'BODY' => $this->body,
84+
'FROM' => $this->originator,
85+
'REFERENCE' => $this->reference,
8786
'MINIMUMNUMBEROFMESSAGEPARTS' => $this->minimumNumberOfMessageParts,
8887
'MAXIMUMNUMBEROFMESSAGEPARTS' => $this->maximumNumberOfMessageParts,
8988
]);

0 commit comments

Comments
 (0)