Skip to content

Commit 3a3f79c

Browse files
authored
Apply fixes from StyleCI (#40)
Apply fixes from StyleCI
2 parents 8612cf9 + 2c59b95 commit 3a3f79c

File tree

12 files changed

+50
-48
lines changed

12 files changed

+50
-48
lines changed

src/Components/Button.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use NotificationChannels\Facebook\Exceptions\CouldNotCreateButton;
99

1010
/**
11-
* Class Button
11+
* Class Button.
1212
*/
1313
class Button implements JsonSerializable
1414
{
@@ -33,7 +33,7 @@ class Button implements JsonSerializable
3333
*
3434
* @return static
3535
*/
36-
public static function create(string $title = '', $data = null, string $type = ButtonType::WEB_URL): Button
36+
public static function create(string $title = '', $data = null, string $type = ButtonType::WEB_URL): self
3737
{
3838
return new static($title, $data, $type);
3939
}
@@ -89,7 +89,7 @@ public function url(string $url): self
8989
throw CouldNotCreateButton::urlNotProvided();
9090
}
9191

92-
if (!filter_var($url, FILTER_VALIDATE_URL)) {
92+
if (! filter_var($url, FILTER_VALIDATE_URL)) {
9393
throw CouldNotCreateButton::invalidUrlProvided($url);
9494
}
9595

@@ -111,7 +111,7 @@ public function phone(string $phone): self
111111
throw CouldNotCreateButton::phoneNumberNotProvided();
112112
}
113113

114-
if (is_string($phone) && !Str::startsWith($phone, '+')) {
114+
if (is_string($phone) && ! Str::startsWith($phone, '+')) {
115115
throw CouldNotCreateButton::invalidPhoneNumberProvided($phone);
116116
}
117117

src/Components/Card.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use NotificationChannels\Facebook\Exceptions\CouldNotCreateCard;
88

99
/**
10-
* Class Card
10+
* Class Card.
1111
*/
1212
class Card implements JsonSerializable
1313
{
@@ -24,7 +24,7 @@ class Card implements JsonSerializable
2424
* @throws CouldNotCreateCard
2525
* @return static
2626
*/
27-
public static function create(string $title = ''): Card
27+
public static function create(string $title = ''): self
2828
{
2929
return new static($title);
3030
}
@@ -117,7 +117,7 @@ public function subtitle(string $subtitle): self
117117
*/
118118
public function toArray(): array
119119
{
120-
if (!isset($this->payload['title'])) {
120+
if (! isset($this->payload['title'])) {
121121
throw CouldNotCreateCard::titleNotProvided();
122122
}
123123

src/Exceptions/CouldNotCreateButton.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Exception;
66

77
/**
8-
* Class CouldNotCreateButton
8+
* Class CouldNotCreateButton.
99
*/
1010
class CouldNotCreateButton extends Exception
1111
{
@@ -14,7 +14,7 @@ class CouldNotCreateButton extends Exception
1414
*
1515
* @return static
1616
*/
17-
public static function titleNotProvided(): CouldNotCreateButton
17+
public static function titleNotProvided(): self
1818
{
1919
return new static('Button title was not provided, A 20 character limited title should be provided.');
2020
}
@@ -24,7 +24,7 @@ public static function titleNotProvided(): CouldNotCreateButton
2424
*
2525
* @return static
2626
*/
27-
public static function urlNotProvided(): CouldNotCreateButton
27+
public static function urlNotProvided(): self
2828
{
2929
return new static('Your button type is `web_url` but the url is not provided.');
3030
}
@@ -34,7 +34,7 @@ public static function urlNotProvided(): CouldNotCreateButton
3434
*
3535
* @return static
3636
*/
37-
public static function phoneNumberNotProvided(): CouldNotCreateButton
37+
public static function phoneNumberNotProvided(): self
3838
{
3939
return new static('Your button type is `phone_number` but the phone number is not provided.');
4040
}
@@ -44,7 +44,7 @@ public static function phoneNumberNotProvided(): CouldNotCreateButton
4444
*
4545
* @return static
4646
*/
47-
public static function postbackNotProvided(): CouldNotCreateButton
47+
public static function postbackNotProvided(): self
4848
{
4949
return new static('Your button type is `postback` but the postback data is not provided.');
5050
}
@@ -56,7 +56,7 @@ public static function postbackNotProvided(): CouldNotCreateButton
5656
*
5757
* @return static
5858
*/
59-
public static function titleLimitExceeded(string $title): CouldNotCreateButton
59+
public static function titleLimitExceeded(string $title): self
6060
{
6161
$count = mb_strlen($title);
6262

@@ -72,7 +72,7 @@ public static function titleLimitExceeded(string $title): CouldNotCreateButton
7272
*
7373
* @return static
7474
*/
75-
public static function payloadLimitExceeded($data): CouldNotCreateButton
75+
public static function payloadLimitExceeded($data): self
7676
{
7777
$count = mb_strlen($data);
7878

@@ -88,7 +88,7 @@ public static function payloadLimitExceeded($data): CouldNotCreateButton
8888
*
8989
* @return static
9090
*/
91-
public static function invalidUrlProvided(string $url): CouldNotCreateButton
91+
public static function invalidUrlProvided(string $url): self
9292
{
9393
return new static("`{$url}` is not a valid URL. Please check and provide a valid URL");
9494
}
@@ -100,7 +100,7 @@ public static function invalidUrlProvided(string $url): CouldNotCreateButton
100100
*
101101
* @return static
102102
*/
103-
public static function invalidPhoneNumberProvided(string $phoneNumber): CouldNotCreateButton
103+
public static function invalidPhoneNumberProvided(string $phoneNumber): self
104104
{
105105
return new static(
106106
"Provided phone number `{$phoneNumber}` format is invalid.".

src/Exceptions/CouldNotCreateCard.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Exception;
66

77
/**
8-
* Class CouldNotCreateCard
8+
* Class CouldNotCreateCard.
99
*/
1010
class CouldNotCreateCard extends Exception
1111
{
@@ -14,7 +14,7 @@ class CouldNotCreateCard extends Exception
1414
*
1515
* @return static
1616
*/
17-
public static function titleNotProvided(): CouldNotCreateCard
17+
public static function titleNotProvided(): self
1818
{
1919
return new static('Button title was not provided, A 20 character limited title should be provided.');
2020
}
@@ -26,7 +26,7 @@ public static function titleNotProvided(): CouldNotCreateCard
2626
*
2727
* @return static
2828
*/
29-
public static function titleLimitExceeded(string $title): CouldNotCreateCard
29+
public static function titleLimitExceeded(string $title): self
3030
{
3131
$count = mb_strlen($title);
3232

@@ -42,7 +42,7 @@ public static function titleLimitExceeded(string $title): CouldNotCreateCard
4242
*
4343
* @return static
4444
*/
45-
public static function subtitleLimitExceeded(string $title): CouldNotCreateCard
45+
public static function subtitleLimitExceeded(string $title): self
4646
{
4747
$count = mb_strlen($title);
4848

src/Exceptions/CouldNotCreateMessage.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Exception;
66

77
/**
8-
* Class CouldNotCreateMessage
8+
* Class CouldNotCreateMessage.
99
*/
1010
class CouldNotCreateMessage extends Exception
1111
{
@@ -14,7 +14,7 @@ class CouldNotCreateMessage extends Exception
1414
*
1515
* @return static
1616
*/
17-
public static function textTooLong(): CouldNotCreateMessage
17+
public static function textTooLong(): self
1818
{
1919
return new static('Message text is too long, A 320 character limited string should be provided.');
2020
}
@@ -24,7 +24,7 @@ public static function textTooLong(): CouldNotCreateMessage
2424
*
2525
* @return static
2626
*/
27-
public static function invalidNotificationType(): CouldNotCreateMessage
27+
public static function invalidNotificationType(): self
2828
{
2929
return new static('Notification Type provided is invalid.');
3030
}
@@ -34,7 +34,7 @@ public static function invalidNotificationType(): CouldNotCreateMessage
3434
*
3535
* @return static
3636
*/
37-
public static function invalidAttachmentType(): CouldNotCreateMessage
37+
public static function invalidAttachmentType(): self
3838
{
3939
return new static('Attachment Type provided is invalid.');
4040
}
@@ -44,7 +44,7 @@ public static function invalidAttachmentType(): CouldNotCreateMessage
4444
*
4545
* @return static
4646
*/
47-
public static function urlNotProvided(): CouldNotCreateMessage
47+
public static function urlNotProvided(): self
4848
{
4949
return new static('You have not provided a Url for an attachment');
5050
}
@@ -54,7 +54,7 @@ public static function urlNotProvided(): CouldNotCreateMessage
5454
*
5555
* @return static
5656
*/
57-
public static function dataNotProvided(): CouldNotCreateMessage
57+
public static function dataNotProvided(): self
5858
{
5959
return new static('Your message was missing critical information');
6060
}
@@ -64,7 +64,7 @@ public static function dataNotProvided(): CouldNotCreateMessage
6464
*
6565
* @return static
6666
*/
67-
public static function messageButtonsLimitExceeded(): CouldNotCreateMessage
67+
public static function messageButtonsLimitExceeded(): self
6868
{
6969
return new static('You cannot add more than 3 buttons in 1 notification message.');
7070
}
@@ -74,7 +74,7 @@ public static function messageButtonsLimitExceeded(): CouldNotCreateMessage
7474
*
7575
* @return static
7676
*/
77-
public static function messageCardsLimitExceeded(): CouldNotCreateMessage
77+
public static function messageCardsLimitExceeded(): self
7878
{
7979
return new static('You cannot add more than 10 cards in 1 notification message.');
8080
}
@@ -84,7 +84,7 @@ public static function messageCardsLimitExceeded(): CouldNotCreateMessage
8484
*
8585
* @return static
8686
*/
87-
public static function recipientNotProvided(): CouldNotCreateMessage
87+
public static function recipientNotProvided(): self
8888
{
8989
return new static('Facebook notification recipient ID or Phone Number was not provided. Please refer usage docs.');
9090
}

src/Exceptions/CouldNotSendNotification.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use GuzzleHttp\Exception\ClientException;
77

88
/**
9-
* Class CouldNotSendNotification
9+
* Class CouldNotSendNotification.
1010
*/
1111
class CouldNotSendNotification extends Exception
1212
{
@@ -17,7 +17,7 @@ class CouldNotSendNotification extends Exception
1717
*
1818
* @return static
1919
*/
20-
public static function facebookRespondedWithAnError(ClientException $exception): CouldNotSendNotification
20+
public static function facebookRespondedWithAnError(ClientException $exception): self
2121
{
2222
if ($exception->hasResponse()) {
2323
$result = json_decode($exception->getResponse()->getBody(), false);
@@ -35,7 +35,7 @@ public static function facebookRespondedWithAnError(ClientException $exception):
3535
*
3636
* @return static
3737
*/
38-
public static function facebookPageTokenNotProvided(string $message): CouldNotSendNotification
38+
public static function facebookPageTokenNotProvided(string $message): self
3939
{
4040
return new static($message);
4141
}
@@ -47,7 +47,7 @@ public static function facebookPageTokenNotProvided(string $message): CouldNotSe
4747
*
4848
* @return static
4949
*/
50-
public static function couldNotCommunicateWithFacebook(Exception $exception): CouldNotSendNotification
50+
public static function couldNotCommunicateWithFacebook(Exception $exception): self
5151
{
5252
return new static('The communication with Facebook failed. Reason: '.$exception->getMessage());
5353
}

src/Facebook.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use NotificationChannels\Facebook\Exceptions\CouldNotSendNotification;
1111

1212
/**
13-
* Class Facebook
13+
* Class Facebook.
1414
*/
1515
class Facebook
1616
{
@@ -41,7 +41,7 @@ public function __construct(string $token = null, HttpClient $httpClient = null)
4141
*
4242
* @return Facebook
4343
*/
44-
public function setGraphApiVersion($graphApiVersion): Facebook
44+
public function setGraphApiVersion($graphApiVersion): self
4545
{
4646
$this->graphApiVersion = $graphApiVersion;
4747

src/FacebookChannel.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use GuzzleHttp\Exception\GuzzleException;
66
use Illuminate\Notifications\Notification;
7-
use NotificationChannels\Facebook\Exceptions\{CouldNotCreateMessage, CouldNotSendNotification};
7+
use NotificationChannels\Facebook\Exceptions\CouldNotCreateMessage;
8+
use NotificationChannels\Facebook\Exceptions\CouldNotSendNotification;
89

910
/**
10-
* Class FacebookChannel
11+
* Class FacebookChannel.
1112
*/
1213
class FacebookChannel
1314
{
@@ -43,7 +44,7 @@ public function send($notifiable, Notification $notification): void
4344
}
4445

4546
if ($message->toNotGiven()) {
46-
if (!$to = $notifiable->routeNotificationFor('facebook')) {
47+
if (! $to = $notifiable->routeNotificationFor('facebook')) {
4748
throw CouldNotCreateMessage::recipientNotProvided();
4849
}
4950

src/FacebookMessage.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44

55
use JsonSerializable;
66
use NotificationChannels\Facebook\Traits\HasButtons;
7+
use NotificationChannels\Facebook\Enums\MessagingType;
8+
use NotificationChannels\Facebook\Enums\RecipientType;
9+
use NotificationChannels\Facebook\Enums\AttachmentType;
10+
use NotificationChannels\Facebook\Enums\NotificationType;
711
use NotificationChannels\Facebook\Exceptions\CouldNotCreateMessage;
8-
use NotificationChannels\Facebook\Enums\{MessagingType, RecipientType, AttachmentType, NotificationType};
912

1013
/**
1114
* Class FacebookMessage.
@@ -53,7 +56,7 @@ class FacebookMessage implements JsonSerializable
5356
* @throws CouldNotCreateMessage
5457
* @return static
5558
*/
56-
public static function create(string $text = ''): FacebookMessage
59+
public static function create(string $text = ''): self
5760
{
5861
return new static($text);
5962
}
@@ -134,7 +137,7 @@ public function attach(string $attachmentType, string $url): self
134137
AttachmentType::AUDIO,
135138
];
136139

137-
if (!in_array($attachmentType, $attachmentTypes, false)) {
140+
if (! in_array($attachmentType, $attachmentTypes, false)) {
138141
throw CouldNotCreateMessage::invalidAttachmentType();
139142
}
140143

@@ -165,7 +168,7 @@ public function notificationType(string $notificationType): self
165168
NotificationType::NO_PUSH,
166169
];
167170

168-
if (!in_array($notificationType, $notificationTypes, false)) {
171+
if (! in_array($notificationType, $notificationTypes, false)) {
169172
throw CouldNotCreateMessage::invalidNotificationType();
170173
}
171174

@@ -275,7 +278,7 @@ public function cards(array $cards): self
275278
*/
276279
public function toNotGiven(): bool
277280
{
278-
return !isset($this->recipient);
281+
return ! isset($this->recipient);
279282
}
280283

281284
/**

src/FacebookServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Support\ServiceProvider;
66

77
/**
8-
* Class FacebookServiceProvider
8+
* Class FacebookServiceProvider.
99
*/
1010
class FacebookServiceProvider extends ServiceProvider
1111
{

0 commit comments

Comments
 (0)