From 2b5a35ded00f286d04212fdbbda6b85f1b3abf40 Mon Sep 17 00:00:00 2001 From: Osaigbovo Emmanuel <55060799+ossycodes@users.noreply.github.com> Date: Fri, 10 Mar 2023 00:41:14 +0100 Subject: [PATCH] fix styleCI (#23) * wip * wip * wip * wip --- src/AfricasTalkingChannel.php | 22 ++++++++++----------- src/AfricasTalkingMessage.php | 10 +++++----- src/Exceptions/CouldNotSendNotification.php | 7 +++---- tests/AfricasTalkingChannelTest.php | 7 ++++--- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/AfricasTalkingChannel.php b/src/AfricasTalkingChannel.php index 6c21331..30bf72d 100644 --- a/src/AfricasTalkingChannel.php +++ b/src/AfricasTalkingChannel.php @@ -2,11 +2,11 @@ namespace NotificationChannels\AfricasTalking; +use AfricasTalking\SDK\AfricasTalking as AfricasTalkingSDK; use Exception; use Illuminate\Notifications\Notification; -use AfricasTalking\SDK\AfricasTalking as AfricasTalkingSDK; -use NotificationChannels\AfricasTalking\Exceptions\InvalidPhonenumber; use NotificationChannels\AfricasTalking\Exceptions\CouldNotSendNotification; +use NotificationChannels\AfricasTalking\Exceptions\InvalidPhonenumber; class AfricasTalkingChannel { @@ -22,8 +22,9 @@ public function __construct(AfricasTalkingSDK $africasTalking) /** * Send the given notification. * - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * * @throws CouldNotSendNotification */ public function send($notifiable, Notification $notification) @@ -32,7 +33,7 @@ public function send($notifiable, Notification $notification) $phoneNumber = $this->getTo($notifiable, $notification, $message); - if(empty($phoneNumber)) { + if (empty($phoneNumber)) { throw InvalidPhonenumber::configurationNotSet(); } @@ -43,10 +44,10 @@ public function send($notifiable, Notification $notification) ]; } else { $params = [ - 'to' => $phoneNumber, - 'message' => $message->getContent(), - 'from' => $message->getSender(), - ]; + 'to' => $phoneNumber, + 'message' => $message->getContent(), + 'from' => $message->getSender(), + ]; } try { @@ -56,10 +57,9 @@ public function send($notifiable, Notification $notification) } } - private function getTo($notifiable, Notification $notification, AfricasTalkingMessage $message) { - if(!empty($message->getTo())) { + if (! empty($message->getTo())) { return $message->getTo(); } diff --git a/src/AfricasTalkingMessage.php b/src/AfricasTalkingMessage.php index 7bd9114..2d0548a 100644 --- a/src/AfricasTalkingMessage.php +++ b/src/AfricasTalkingMessage.php @@ -16,8 +16,8 @@ class AfricasTalkingMessage /** * Set content for this message. * - * @param string $content - * @return this + * @param string $content + * @return $this */ public function content(string $content): self { @@ -29,7 +29,7 @@ public function content(string $content): self /** * Set sender for this message. * - * @param string $from + * @param string $from * @return self */ public function from(string $from): self @@ -39,10 +39,10 @@ public function from(string $from): self return $this; } - /** + /** * Set recipient for this message. * - * @param string $from + * @param string $from * @return self */ public function to(string $to): self diff --git a/src/Exceptions/CouldNotSendNotification.php b/src/Exceptions/CouldNotSendNotification.php index 5847f6a..988be15 100644 --- a/src/Exceptions/CouldNotSendNotification.php +++ b/src/Exceptions/CouldNotSendNotification.php @@ -7,7 +7,7 @@ class CouldNotSendNotification extends Exception { /** - * @param string $error + * @param string $error * @return CouldNotSendNotification */ public static function serviceRespondedWithAnError(string $error): self @@ -15,10 +15,9 @@ public static function serviceRespondedWithAnError(string $error): self return new static("AfricasTalking service responded with an error: {$error}"); } - public static function invalidReceiver(): self { - return new static("The notifiable did not have a receiving phone number. Add a routeNotificationForAfricasTalking - method or a phone_number attribute to your notifiable."); + return new static('The notifiable did not have a receiving phone number. Add a routeNotificationForAfricasTalking + method or a phone_number attribute to your notifiable.'); } } diff --git a/tests/AfricasTalkingChannelTest.php b/tests/AfricasTalkingChannelTest.php index b6634ae..6625684 100644 --- a/tests/AfricasTalkingChannelTest.php +++ b/tests/AfricasTalkingChannelTest.php @@ -59,7 +59,7 @@ public function it_can_send_sms_notification_to_anonymous_notifiable_using_class ->once() ->andReturn(200); - $this->channel->send((new AnonymousNotifiable())->route(AfricasTalkingChannel::class, "+1111111111"), new TestNotification); + $this->channel->send((new AnonymousNotifiable())->route(AfricasTalkingChannel::class, '+1111111111'), new TestNotification); } /** @test */ @@ -73,7 +73,7 @@ public function it_can_send_sms_notification_to_anonymous_notifiable_using_strin ->once() ->andReturn(200); - $this->channel->send((new AnonymousNotifiable())->route('africasTalking', "+1111111111"), new TestNotification); + $this->channel->send((new AnonymousNotifiable())->route('africasTalking', '+1111111111'), new TestNotification); } /** @test */ @@ -123,6 +123,7 @@ class TestNotification extends Notification /** * @param $notifiable * @return AfricasTalkingMessage + * * @throws CouldNotSendNotification */ public function toAfricasTalking($notifiable) @@ -136,6 +137,7 @@ class TestNotificationWithGetTo extends Notification /** * @param $notifiable * @return AfricasTalkingMessage + * * @throws CouldNotSendNotification */ public function toAfricasTalking($notifiable) @@ -145,7 +147,6 @@ public function toAfricasTalking($notifiable) } } - class Notifiable { public $phone_number = null;