From 6609f52e3dd6a2051ccfd3c2b3e157ca7dfeed15 Mon Sep 17 00:00:00 2001
From: JonoB <JonoB@users.noreply.github.com>
Date: Thu, 18 Apr 2024 13:23:23 +0000
Subject: [PATCH] Apply php-cs-fixer changes

---
 database/factories/TemplateFactory.php        |  2 +-
 ..._223029_create_campaign_statuses_table.php |  8 +++----
 .../2020_10_16_092234_prefix_tables.php       |  2 +-
 src/Adapters/PostalAdapter.php                | 13 ++++------
 src/Adapters/SendgridMailAdapter.php          |  2 +-
 src/Adapters/SmtpAdapter.php                  |  2 +-
 src/Events/MessageDispatchEvent.php           |  4 +++-
 src/Events/SubscriberAddedEvent.php           |  4 +++-
 .../Webhooks/MailgunWebhookReceived.php       |  4 +++-
 src/Facades/Helper.php                        |  1 -
 src/Factories/MailAdapterFactory.php          |  8 +++----
 .../Api/Webhooks/PostalWebhooksController.php |  4 +---
 .../Api/Webhooks/SesWebhooksController.php    |  2 +-
 .../Controllers/Auth/RegisterController.php   |  4 ++--
 .../CampaignCancellationController.php        |  4 ++--
 .../Campaigns/CampaignDeleteController.php    |  4 ++--
 .../Campaigns/CampaignDispatchController.php  |  2 +-
 .../Campaigns/CampaignTestController.php      |  2 +-
 .../Campaigns/CampaignsController.php         |  4 ++--
 src/Http/Controllers/Controller.php           |  4 +++-
 .../TestEmailServiceController.php            |  3 +--
 src/Http/Controllers/MessagesController.php   |  6 ++---
 .../Subscribers/SubscribersController.php     |  6 ++---
 .../SubscribersImportController.php           |  4 ++--
 src/Http/Requests/EmailServiceRequest.php     |  2 +-
 src/Http/Requests/EmailServiceTestRequest.php |  1 -
 src/Interfaces/BaseEloquentInterface.php      |  4 +++-
 .../Webhooks/HandleMailgunWebhook.php         |  6 ++---
 .../Webhooks/HandlePostalWebhook.php          | 14 +++++------
 src/Listeners/Webhooks/HandleSesWebhook.php   |  8 +++----
 src/Models/Campaign.php                       |  2 +-
 src/Models/Message.php                        |  2 +-
 src/Models/UnsubscribeEventType.php           |  8 +++----
 src/Presenters/CampaignReportPresenter.php    |  2 +-
 src/Providers/EventServiceProvider.php        |  4 ++--
 src/Providers/ResolverProvider.php            |  1 -
 src/Repositories/BaseEloquentRepository.php   |  8 ++++---
 src/Repositories/BaseTenantRepository.php     |  8 ++++---
 .../EmailServiceTenantRepository.php          |  1 -
 .../Messages/BaseMessageTenantRepository.php  |  2 +-
 .../PostgresMessageTenantRepository.php       |  4 ++--
 .../BaseSubscriberTenantRepository.php        |  1 +
 src/Routes/WebRoutes.php                      |  1 -
 src/Rules/CanAccessSubscriber.php             |  2 +-
 src/Rules/CanAccessTag.php                    |  2 +-
 src/Services/Content/MergeContentService.php  |  8 +++----
 src/Services/Helper.php                       |  3 +--
 src/Services/Messages/DispatchMessage.php     |  8 +++----
 src/Services/Messages/DispatchTestMessage.php |  4 ++--
 .../Messages/MessageTrackingOptions.php       |  4 ++--
 src/Services/Messages/ResolveEmailService.php |  4 ++--
 src/Services/Sendportal.php                   |  2 +-
 .../Subscribers/ApiSubscriberService.php      |  2 +-
 .../Subscribers/ImportSubscriberService.php   |  6 ++---
 src/Services/Tags/ApiTagService.php           |  2 +-
 src/Services/Webhooks/EmailWebhookService.php | 24 +++++++++----------
 tests/Feature/API/CampaignsControllerTest.php |  4 ++--
 .../API/SubscriberTagsControllerTest.php      |  4 ++--
 .../Feature/API/SubscribersControllerTest.php |  4 ++--
 .../API/TagSubscribersControllerTest.php      |  4 ++--
 tests/Feature/API/TagsControllerTest.php      |  4 ++--
 tests/Feature/API/TemplatesControllerTest.php |  6 ++---
 .../Campaigns/CampaignControllerTest.php      |  4 ++--
 tests/Feature/Content/MergeContentTest.php    |  4 ++--
 tests/Feature/Content/MergeSubjectTest.php    |  4 ++--
 .../EmailServicesControllerTest.php           |  4 ++--
 .../Subscribers/SubscribersControllerTest.php |  4 ++--
 .../SubscribersImportControllerTest.php       |  4 ++--
 tests/Feature/Tags/TagsControllerTest.php     |  4 ++--
 .../Templates/TemplatesControllerTest.php     |  6 ++---
 tests/Feature/Webhooks/AwsWebhooksTest.php    |  4 ++--
 .../Messages/MessageTrackingOptionsTest.php   |  6 ++---
 72 files changed, 160 insertions(+), 159 deletions(-)

diff --git a/database/factories/TemplateFactory.php b/database/factories/TemplateFactory.php
index 4e0d98f4..270657ef 100644
--- a/database/factories/TemplateFactory.php
+++ b/database/factories/TemplateFactory.php
@@ -12,7 +12,7 @@ class TemplateFactory extends Factory
 {
     /** @var string */
     protected $model = Template::class;
-    
+
     public function definition(): array
     {
         return [
diff --git a/database/migrations/2017_04_28_223029_create_campaign_statuses_table.php b/database/migrations/2017_04_28_223029_create_campaign_statuses_table.php
index 22afa0dd..63c6e299 100644
--- a/database/migrations/2017_04_28_223029_create_campaign_statuses_table.php
+++ b/database/migrations/2017_04_28_223029_create_campaign_statuses_table.php
@@ -20,10 +20,10 @@ public function up()
 
         DB::table('sendportal_campaign_statuses')
             ->insert([
-               ['name' => 'Draft'],
-               ['name' => 'Queued'],
-               ['name' => 'Sending'],
-               ['name' => 'Sent'],
+                ['name' => 'Draft'],
+                ['name' => 'Queued'],
+                ['name' => 'Sending'],
+                ['name' => 'Sent'],
             ]);
     }
 }
diff --git a/database/migrations/2020_10_16_092234_prefix_tables.php b/database/migrations/2020_10_16_092234_prefix_tables.php
index beded6e5..3c7fa23f 100644
--- a/database/migrations/2020_10_16_092234_prefix_tables.php
+++ b/database/migrations/2020_10_16_092234_prefix_tables.php
@@ -17,7 +17,7 @@ public function up()
                 continue;
             }
 
-            if (!Schema::hasTable("{$table}")) {
+            if (! Schema::hasTable("{$table}")) {
                 continue;
             }
 
diff --git a/src/Adapters/PostalAdapter.php b/src/Adapters/PostalAdapter.php
index 33389486..23eded02 100644
--- a/src/Adapters/PostalAdapter.php
+++ b/src/Adapters/PostalAdapter.php
@@ -6,15 +6,12 @@
 
 use DomainException;
 use Illuminate\Support\Arr;
-use Illuminate\Support\Str;
 use Postal\Client;
 use Postal\SendMessage;
 use Sendportal\Base\Services\Messages\MessageTrackingOptions;
-use Symfony\Component\HttpFoundation\Response;
 
 class PostalAdapter extends BaseMailAdapter
 {
-  
     /**
      * @throws TypeException
      * @throws \Throwable
@@ -22,25 +19,25 @@ class PostalAdapter extends BaseMailAdapter
     public function send(string $fromEmail, string $fromName, string $toEmail, string $subject, MessageTrackingOptions $trackingOptions, string $content): string
     {
         $client = new Client('https://' . Arr::get($this->config, 'postal_host'), Arr::get($this->config, 'key'));
-        
+
         $message = new SendMessage($client);
         $message->to($toEmail);
         $message->from($fromName.' <'.$fromEmail.'>');
         $message->subject($subject);
         $message->htmlBody($content);
         $response = $message->send();
-        
+
         return $this->resolveMessageId($response);
     }
 
- 
+
 
     protected function resolveMessageId($response): string
     {
         foreach ($response->recipients() as $email => $message) {
-            return (string) $message->id();    
+            return (string) $message->id();
         }
-        
+
         throw new DomainException('Unable to resolve message ID');
     }
 }
diff --git a/src/Adapters/SendgridMailAdapter.php b/src/Adapters/SendgridMailAdapter.php
index c01cadfd..78db586d 100644
--- a/src/Adapters/SendgridMailAdapter.php
+++ b/src/Adapters/SendgridMailAdapter.php
@@ -36,7 +36,7 @@ public function send(string $fromEmail, string $fromName, string $toEmail, strin
         $response = $this->resolveClient()->send($email);
 
         throw_if(
-            !in_array($response->statusCode(), [Response::HTTP_OK, Response::HTTP_ACCEPTED]),
+            ! in_array($response->statusCode(), [Response::HTTP_OK, Response::HTTP_ACCEPTED]),
             new DomainException($response->body(), $response->statusCode())
         );
 
diff --git a/src/Adapters/SmtpAdapter.php b/src/Adapters/SmtpAdapter.php
index e9fdb131..64cc277a 100644
--- a/src/Adapters/SmtpAdapter.php
+++ b/src/Adapters/SmtpAdapter.php
@@ -53,7 +53,7 @@ protected function resolveTransport(): EsmtpTransport
 
         $encryption = Arr::get($this->config, 'encryption');
 
-        $scheme = !is_null($encryption) && $encryption === 'tls'
+        $scheme = ! is_null($encryption) && $encryption === 'tls'
             ? ((Arr::get($this->config, 'port') == 465) ? 'smtps' : 'smtp')
             : '';
 
diff --git a/src/Events/MessageDispatchEvent.php b/src/Events/MessageDispatchEvent.php
index 712e300d..8d1084e4 100644
--- a/src/Events/MessageDispatchEvent.php
+++ b/src/Events/MessageDispatchEvent.php
@@ -10,7 +10,9 @@
 
 class MessageDispatchEvent
 {
-    use Dispatchable, InteractsWithSockets, SerializesModels;
+    use Dispatchable;
+    use InteractsWithSockets;
+    use SerializesModels;
 
     /**
      * @var Message
diff --git a/src/Events/SubscriberAddedEvent.php b/src/Events/SubscriberAddedEvent.php
index 8dfdf0d5..f4b4ffe6 100644
--- a/src/Events/SubscriberAddedEvent.php
+++ b/src/Events/SubscriberAddedEvent.php
@@ -11,7 +11,9 @@
 
 class SubscriberAddedEvent
 {
-    use Dispatchable, InteractsWithSockets, SerializesModels;
+    use Dispatchable;
+    use InteractsWithSockets;
+    use SerializesModels;
 
     /** @var Subscriber */
     public $subscriber;
diff --git a/src/Events/Webhooks/MailgunWebhookReceived.php b/src/Events/Webhooks/MailgunWebhookReceived.php
index b6c37010..d8acf1df 100644
--- a/src/Events/Webhooks/MailgunWebhookReceived.php
+++ b/src/Events/Webhooks/MailgunWebhookReceived.php
@@ -8,7 +8,9 @@
 
 class MailgunWebhookReceived
 {
-    use Dispatchable, InteractsWithSockets, SerializesModels;
+    use Dispatchable;
+    use InteractsWithSockets;
+    use SerializesModels;
 
     /** @var array */
     public $payload;
diff --git a/src/Facades/Helper.php b/src/Facades/Helper.php
index 9f75bf36..cb0c5e45 100644
--- a/src/Facades/Helper.php
+++ b/src/Facades/Helper.php
@@ -6,7 +6,6 @@
 
 class Helper extends Facade
 {
-
     /**
      * @return string
      */
diff --git a/src/Factories/MailAdapterFactory.php b/src/Factories/MailAdapterFactory.php
index fa6b7c4d..307f6a6e 100644
--- a/src/Factories/MailAdapterFactory.php
+++ b/src/Factories/MailAdapterFactory.php
@@ -7,11 +7,11 @@
 use InvalidArgumentException;
 use Sendportal\Base\Adapters\MailgunMailAdapter;
 use Sendportal\Base\Adapters\MailjetAdapter;
+use Sendportal\Base\Adapters\PostalAdapter;
 use Sendportal\Base\Adapters\PostmarkMailAdapter;
 use Sendportal\Base\Adapters\SendgridMailAdapter;
 use Sendportal\Base\Adapters\SesMailAdapter;
 use Sendportal\Base\Adapters\SmtpAdapter;
-use Sendportal\Base\Adapters\PostalAdapter;
 use Sendportal\Base\Interfaces\MailAdapterInterface;
 use Sendportal\Base\Models\EmailService;
 use Sendportal\Base\Models\EmailServiceType;
@@ -57,13 +57,13 @@ private function cache(MailAdapterInterface $adapter, EmailService $emailService
      */
     private function resolve(EmailService $emailService): MailAdapterInterface
     {
-        if (!$emailServiceType = EmailServiceType::resolve($emailService->type_id)) {
-            throw new InvalidArgumentException("Unable to resolve mail provider type from ID [$emailService->type_id].");
+        if (! $emailServiceType = EmailServiceType::resolve($emailService->type_id)) {
+            throw new InvalidArgumentException("Unable to resolve mail provider type from ID [{$emailService->type_id}].");
         }
 
         $adapterClass = self::$adapterMap[$emailService->type_id] ?? null;
 
-        if (!$adapterClass) {
+        if (! $adapterClass) {
             throw new InvalidArgumentException("Mail adapter type [{$emailServiceType}] is not supported.");
         }
 
diff --git a/src/Http/Controllers/Api/Webhooks/PostalWebhooksController.php b/src/Http/Controllers/Api/Webhooks/PostalWebhooksController.php
index 80fa31ad..246b1c43 100644
--- a/src/Http/Controllers/Api/Webhooks/PostalWebhooksController.php
+++ b/src/Http/Controllers/Api/Webhooks/PostalWebhooksController.php
@@ -4,8 +4,6 @@
 
 namespace Sendportal\Base\Http\Controllers\Api\Webhooks;
 
-use Illuminate\Support\Arr;
-
 use Illuminate\Http\Response;
 use Illuminate\Support\Facades\Log;
 use Sendportal\Base\Events\Webhooks\PostalWebhookReceived;
@@ -20,7 +18,7 @@ public function handle(): Response
         Log::info('Postal webhook received');
 
         event(new PostalWebhookReceived($payload));
-        
+
 
         return response('OK');
     }
diff --git a/src/Http/Controllers/Api/Webhooks/SesWebhooksController.php b/src/Http/Controllers/Api/Webhooks/SesWebhooksController.php
index 61551211..35f256fd 100644
--- a/src/Http/Controllers/Api/Webhooks/SesWebhooksController.php
+++ b/src/Http/Controllers/Api/Webhooks/SesWebhooksController.php
@@ -23,7 +23,7 @@ public function handle(): Response
 
         $payloadType = $payload['Type'] ?? null;
 
-        if (!in_array($payloadType, ['SubscriptionConfirmation', 'Notification'], true)) {
+        if (! in_array($payloadType, ['SubscriptionConfirmation', 'Notification'], true)) {
             return response('OK (not processed).');
         }
 
diff --git a/src/Http/Controllers/Auth/RegisterController.php b/src/Http/Controllers/Auth/RegisterController.php
index f3491445..a6df2594 100644
--- a/src/Http/Controllers/Auth/RegisterController.php
+++ b/src/Http/Controllers/Auth/RegisterController.php
@@ -21,8 +21,8 @@
 
 class RegisterController extends Controller
 {
-    use RegistersUsers,
-        ChecksInvitations;
+    use RegistersUsers;
+    use ChecksInvitations;
 
     /** @var AcceptInvitation */
     private $acceptInvitation;
diff --git a/src/Http/Controllers/Campaigns/CampaignCancellationController.php b/src/Http/Controllers/Campaigns/CampaignCancellationController.php
index 89af552a..47b346db 100644
--- a/src/Http/Controllers/Campaigns/CampaignCancellationController.php
+++ b/src/Http/Controllers/Campaigns/CampaignCancellationController.php
@@ -43,13 +43,13 @@ public function cancel(int $campaignId)
         $campaign = $this->campaignRepository->find(Sendportal::currentWorkspaceId(), $campaignId, ['status']);
         $originalStatus = $campaign->status;
 
-        if (!$campaign->canBeCancelled()) {
+        if (! $campaign->canBeCancelled()) {
             throw ValidationException::withMessages([
                 'campaignStatus' => "{$campaign->status->name} campaigns cannot be cancelled.",
             ])->redirectTo(route('sendportal.campaigns.index'));
         }
 
-        if ($campaign->save_as_draft && !$campaign->allDraftsCreated()) {
+        if ($campaign->save_as_draft && ! $campaign->allDraftsCreated()) {
             throw ValidationException::withMessages([
                 'messagesPendingDraft' => __('Campaigns that save draft messages cannot be cancelled until all drafts have been created.'),
             ])->redirectTo(route('sendportal.campaigns.index'));
diff --git a/src/Http/Controllers/Campaigns/CampaignDeleteController.php b/src/Http/Controllers/Campaigns/CampaignDeleteController.php
index c6cbb9cd..22ff819e 100644
--- a/src/Http/Controllers/Campaigns/CampaignDeleteController.php
+++ b/src/Http/Controllers/Campaigns/CampaignDeleteController.php
@@ -32,7 +32,7 @@ public function confirm(int $id)
     {
         $campaign = $this->campaigns->find(Sendportal::currentWorkspaceId(), $id);
 
-        if (!$campaign->draft) {
+        if (! $campaign->draft) {
             return redirect()->route('sendportal.campaigns.index')
                 ->withErrors(__('Unable to delete a campaign that is not in draft status'));
         }
@@ -49,7 +49,7 @@ public function destroy(Request $request): RedirectResponse
     {
         $campaign = $this->campaigns->find(Sendportal::currentWorkspaceId(), $request->get('id'));
 
-        if (!$campaign->draft) {
+        if (! $campaign->draft) {
             return redirect()->route('sendportal.campaigns.index')
                 ->withErrors(__('Unable to delete a campaign that is not in draft status'));
         }
diff --git a/src/Http/Controllers/Campaigns/CampaignDispatchController.php b/src/Http/Controllers/Campaigns/CampaignDispatchController.php
index 38742e64..5c108f6c 100644
--- a/src/Http/Controllers/Campaigns/CampaignDispatchController.php
+++ b/src/Http/Controllers/Campaigns/CampaignDispatchController.php
@@ -45,7 +45,7 @@ public function send(CampaignDispatchRequest $request, int $id): RedirectRespons
             return redirect()->route('sendportal.campaigns.status', $id);
         }
 
-        if (!$campaign->email_service_id) {
+        if (! $campaign->email_service_id) {
             return redirect()->route('sendportal.campaigns.edit', $id)
                 ->withErrors(__('Please select an Email Service'));
         }
diff --git a/src/Http/Controllers/Campaigns/CampaignTestController.php b/src/Http/Controllers/Campaigns/CampaignTestController.php
index b1064a57..f1abd68f 100644
--- a/src/Http/Controllers/Campaigns/CampaignTestController.php
+++ b/src/Http/Controllers/Campaigns/CampaignTestController.php
@@ -28,7 +28,7 @@ public function handle(CampaignTestRequest $request, int $campaignId): RedirectR
     {
         $messageId = $this->dispatchTestMessage->handle(Sendportal::currentWorkspaceId(), $campaignId, $request->get('recipient_email'));
 
-        if (!$messageId) {
+        if (! $messageId) {
             return redirect()->route('sendportal.campaigns.preview', $campaignId)
                 ->withInput()
                 ->with(['error', __('Failed to dispatch test email.')]);
diff --git a/src/Http/Controllers/Campaigns/CampaignsController.php b/src/Http/Controllers/Campaigns/CampaignsController.php
index d6f248b8..e4e26a44 100644
--- a/src/Http/Controllers/Campaigns/CampaignsController.php
+++ b/src/Http/Controllers/Campaigns/CampaignsController.php
@@ -164,7 +164,7 @@ public function preview(int $id)
         $campaign = $this->campaigns->find(Sendportal::currentWorkspaceId(), $id);
         $subscriberCount = $this->subscribers->countActive(Sendportal::currentWorkspaceId());
 
-        if (!$campaign->draft) {
+        if (! $campaign->draft) {
             return redirect()->route('sendportal.campaigns.status', $id);
         }
 
@@ -205,7 +205,7 @@ private function handleCheckboxes(array $input): array
         ];
 
         foreach ($checkboxFields as $checkboxField) {
-            if (!isset($input[$checkboxField])) {
+            if (! isset($input[$checkboxField])) {
                 $input[$checkboxField] = false;
             }
         }
diff --git a/src/Http/Controllers/Controller.php b/src/Http/Controllers/Controller.php
index 08046647..efb1bc69 100644
--- a/src/Http/Controllers/Controller.php
+++ b/src/Http/Controllers/Controller.php
@@ -9,5 +9,7 @@
 
 class Controller extends BaseController
 {
-    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
+    use AuthorizesRequests;
+    use DispatchesJobs;
+    use ValidatesRequests;
 }
diff --git a/src/Http/Controllers/EmailServices/TestEmailServiceController.php b/src/Http/Controllers/EmailServices/TestEmailServiceController.php
index aacd36ed..d9943eab 100644
--- a/src/Http/Controllers/EmailServices/TestEmailServiceController.php
+++ b/src/Http/Controllers/EmailServices/TestEmailServiceController.php
@@ -1,6 +1,5 @@
 <?php
 
-
 namespace Sendportal\Base\Http\Controllers\EmailServices;
 
 use Exception;
@@ -45,7 +44,7 @@ public function store(int $emailServiceId, EmailServiceTestRequest $request, Dis
         try {
             $messageId = $dispatchTestMessage->testService(Sendportal::currentWorkspaceId(), $emailService, $options);
 
-            if (!$messageId) {
+            if (! $messageId) {
                 return redirect()
                     ->back()
                     ->with(['error', __('Failed to dispatch test email.')]);
diff --git a/src/Http/Controllers/MessagesController.php b/src/Http/Controllers/MessagesController.php
index d55dc5e1..d065fc5d 100644
--- a/src/Http/Controllers/MessagesController.php
+++ b/src/Http/Controllers/MessagesController.php
@@ -101,7 +101,7 @@ public function show(int $messageId): View
      */
     public function send(): RedirectResponse
     {
-        if (!$message = $this->messageRepo->find(
+        if (! $message = $this->messageRepo->find(
             Sendportal::currentWorkspaceId(),
             request('id'),
             ['subscriber']
@@ -128,7 +128,7 @@ public function send(): RedirectResponse
      */
     public function delete(): RedirectResponse
     {
-        if (!$message = $this->messageRepo->find(
+        if (! $message = $this->messageRepo->find(
             Sendportal::currentWorkspaceId(),
             request('id')
         )) {
@@ -161,7 +161,7 @@ public function sendSelected(): RedirectResponse
             return redirect()->back()->withErrors(__('No messages selected'));
         }
 
-        if (!$messages = $this->messageRepo->getWhereIn(
+        if (! $messages = $this->messageRepo->getWhereIn(
             Sendportal::currentWorkspaceId(),
             request('messages'),
             ['subscriber']
diff --git a/src/Http/Controllers/Subscribers/SubscribersController.php b/src/Http/Controllers/Subscribers/SubscribersController.php
index b87ede05..d0cba3c1 100644
--- a/src/Http/Controllers/Subscribers/SubscribersController.php
+++ b/src/Http/Controllers/Subscribers/SubscribersController.php
@@ -114,7 +114,7 @@ public function update(SubscriberRequest $request, int $id): RedirectResponse
         $data = $request->validated();
 
         // updating subscriber from subscribed -> unsubscribed
-        if (!$request->has('subscribed') && !$subscriber->unsubscribed_at) {
+        if (! $request->has('subscribed') && ! $subscriber->unsubscribed_at) {
             $data['unsubscribed_at'] = now();
             $data['unsubscribe_event_id'] = UnsubscribeEventType::MANUAL_BY_ADMIN;
         } // updating subscriber from unsubscribed -> subscribed
@@ -123,7 +123,7 @@ public function update(SubscriberRequest $request, int $id): RedirectResponse
             $data['unsubscribe_event_id'] = null;
         }
 
-        if (!$request->has('tags')) {
+        if (! $request->has('tags')) {
             $data['tags'] = [];
         }
 
@@ -156,7 +156,7 @@ public function export()
     {
         $subscribers = $this->subscriberRepo->all(Sendportal::currentWorkspaceId(), 'id');
 
-        if (!$subscribers->count()) {
+        if (! $subscribers->count()) {
             return redirect()->route('sendportal.subscribers.index')->withErrors(__('There are no subscribers to export'));
         }
 
diff --git a/src/Http/Controllers/Subscribers/SubscribersImportController.php b/src/Http/Controllers/Subscribers/SubscribersImportController.php
index 3f2e8e17..08718721 100644
--- a/src/Http/Controllers/Subscribers/SubscribersImportController.php
+++ b/src/Http/Controllers/Subscribers/SubscribersImportController.php
@@ -69,7 +69,7 @@ public function store(SubscribersImportRequest $request): RedirectResponse
                 'updated' => 0
             ];
 
-            (new FastExcel)->import(Storage::disk('local')->path($path), function (array $line) use ($request, &$counter) {
+            (new FastExcel())->import(Storage::disk('local')->path($path), function (array $line) use ($request, &$counter) {
                 $data = Arr::only($line, ['id', 'email', 'first_name', 'last_name']);
 
                 $data['tags'] = $request->get('tags') ?? [];
@@ -109,7 +109,7 @@ protected function validateCsvContents(string $path): ViewErrorBag
 
         $row = 1;
 
-        (new FastExcel)->import($path, function (array $line) use ($errors, &$row) {
+        (new FastExcel())->import($path, function (array $line) use ($errors, &$row) {
             $data = Arr::only($line, ['id', 'email', 'first_name', 'last_name']);
 
             try {
diff --git a/src/Http/Requests/EmailServiceRequest.php b/src/Http/Requests/EmailServiceRequest.php
index 03177ff0..22532d7a 100644
--- a/src/Http/Requests/EmailServiceRequest.php
+++ b/src/Http/Requests/EmailServiceRequest.php
@@ -28,7 +28,7 @@ public function rules()
             'name' => ['required']
         ];
 
-        if (!$this->route('id')) {
+        if (! $this->route('id')) {
             $rules['type_id'] = ['required', 'integer'];
         }
 
diff --git a/src/Http/Requests/EmailServiceTestRequest.php b/src/Http/Requests/EmailServiceTestRequest.php
index 4d0cd24f..06182d5a 100644
--- a/src/Http/Requests/EmailServiceTestRequest.php
+++ b/src/Http/Requests/EmailServiceTestRequest.php
@@ -1,6 +1,5 @@
 <?php
 
-
 namespace Sendportal\Base\Http\Requests;
 
 use Illuminate\Foundation\Http\FormRequest;
diff --git a/src/Interfaces/BaseEloquentInterface.php b/src/Interfaces/BaseEloquentInterface.php
index 0dcb7264..a2fe7ed4 100644
--- a/src/Interfaces/BaseEloquentInterface.php
+++ b/src/Interfaces/BaseEloquentInterface.php
@@ -1,4 +1,6 @@
-<?php namespace Sendportal\Base\Interfaces;
+<?php
+
+namespace Sendportal\Base\Interfaces;
 
 interface BaseEloquentInterface
 {
diff --git a/src/Listeners/Webhooks/HandleMailgunWebhook.php b/src/Listeners/Webhooks/HandleMailgunWebhook.php
index c698ae44..6409f2ad 100644
--- a/src/Listeners/Webhooks/HandleMailgunWebhook.php
+++ b/src/Listeners/Webhooks/HandleMailgunWebhook.php
@@ -44,7 +44,7 @@ public function handle(MailgunWebhookReceived $event): void
         $messageId = $this->extractMessageId($event->payload);
         $eventName = $this->extractEventName($event->payload);
 
-        if (!$this->checkWebhookValidity($messageId, $event->payload)) {
+        if (! $this->checkWebhookValidity($messageId, $event->payload)) {
             Log::error('Mailgun webhook failed verification check.', ['payload' => $event->payload]);
             return;
         }
@@ -176,14 +176,14 @@ private function checkWebhookValidity(string $messageId, array $payload): bool
         /** @var EmailService|null $emailservice */
         $emailservice = $message->source->email_service ?? null;
 
-        if (!$emailservice) {
+        if (! $emailservice) {
             return false;
         }
 
         /** @var string|null $signingKey */
         $signingKey = $emailservice->settings['webhook_key'] ?? null;
 
-        if (!$signingKey) {
+        if (! $signingKey) {
             return false;
         }
 
diff --git a/src/Listeners/Webhooks/HandlePostalWebhook.php b/src/Listeners/Webhooks/HandlePostalWebhook.php
index 54e65efb..e15afc97 100644
--- a/src/Listeners/Webhooks/HandlePostalWebhook.php
+++ b/src/Listeners/Webhooks/HandlePostalWebhook.php
@@ -8,7 +8,6 @@
 use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Support\Arr;
 use Illuminate\Support\Facades\Log;
-use Illuminate\Support\Str;
 use RuntimeException;
 use Sendportal\Base\Events\Webhooks\PostalWebhookReceived;
 use Sendportal\Base\Services\Webhooks\EmailWebhookService;
@@ -28,7 +27,6 @@ public function __construct(EmailWebhookService $emailWebhookService)
 
     public function handle(PostalWebhookReceived $event): void
     {
-     
         $messageId = $this->extractMessageId($event->payload);
         $eventName = $this->extractEventName($event->payload);
 
@@ -51,11 +49,11 @@ public function handle(PostalWebhookReceived $event): void
                 $messageId = $this->extractMessageIdBounced($event->payload);
                 $this->handleBounce($messageId, $event->payload);
                 break;
-                
+
             case 'MessageDeliveryFailed':
                 $this->handleFailed($messageId, $event->payload);
                 break;
-                
+
             case 'MessageHeld':
                 $this->handleHeld($messageId, $event->payload);
                 break;
@@ -110,7 +108,7 @@ private function handleFailed(string $messageId, array $content): void
             $this->emailWebhookService->handlePermanentBounce($messageId, $timestamp);
         }
     }
-    
+
     private function handleHeld(string $messageId, array $content): void
     {
         $severity = Arr::get($content, 'payload.status');
@@ -128,7 +126,7 @@ private function extractEventName(array $payload): string
     {
         return Arr::get($payload, 'event');
     }
-    
+
     private function extractMessageIdBounced(array $payload): string
     {
         $messageId = Arr::get($payload, 'payload.original_message.id');
@@ -147,12 +145,12 @@ private function extractTimestampBounced($payload): Carbon
     {
         return Carbon::createFromTimestamp(Arr::get($payload, 'payload.bounce.timestamp'));
     }
-    
+
     private function extractTimestampFailed($payload): Carbon
     {
         return Carbon::createFromTimestamp(Arr::get($payload, 'payload.timestamp'));
     }
-    
+
     private function extractTimestamp($payload): Carbon
     {
         return Carbon::createFromTimestamp(Arr::get($payload, 'timestamp'));
diff --git a/src/Listeners/Webhooks/HandleSesWebhook.php b/src/Listeners/Webhooks/HandleSesWebhook.php
index b5e2d6cf..ab86a77e 100644
--- a/src/Listeners/Webhooks/HandleSesWebhook.php
+++ b/src/Listeners/Webhooks/HandleSesWebhook.php
@@ -40,7 +40,7 @@ public function handle(SesWebhookReceived $event): void
 
         $event = json_decode(Arr::get($event->payload, 'Message'), true);
 
-        if (!$event) {
+        if (! $event) {
             return;
         }
 
@@ -58,12 +58,12 @@ private function processEmailEvent(array $event): void
         /** @var string|null $eventType */
         $eventType = $event['eventType'] ?? null;
 
-        if (!$eventType || !$messageId) {
+        if (! $eventType || ! $messageId) {
             return;
         }
-        
+
         $eventType = strtolower($eventType);
-        
+
         // https://docs.aws.amazon.com/ses/latest/DeveloperGuide/event-publishing-retrieving-sns-examples.html#event-publishing-retrieving-sns-open
         // Bounce, Complaint, Message, Send Email, Reject Event, Open Event, Click Event
         switch ($eventType) {
diff --git a/src/Models/Campaign.php b/src/Models/Campaign.php
index 2b489bad..3ffac05d 100644
--- a/src/Models/Campaign.php
+++ b/src/Models/Campaign.php
@@ -170,7 +170,7 @@ public function getActiveSubscriberCountAttribute(): int
     {
         return Subscriber::where('workspace_id', $this->workspace_id)
             ->whereNull('unsubscribed_at')
-            ->when(!$this->send_to_all, function (Builder $query) {
+            ->when(! $this->send_to_all, function (Builder $query) {
                 $query->whereHas('tags', function (Builder $subQuery) {
                     $subQuery->whereIn('sendportal_tags.id', $this->tags->pluck('id'));
                 });
diff --git a/src/Models/Message.php b/src/Models/Message.php
index 6a2f2619..5efbbfeb 100644
--- a/src/Models/Message.php
+++ b/src/Models/Message.php
@@ -66,7 +66,7 @@ protected static function newFactory()
     protected $guarded = [];
 
     /** @var array */
-    public function casts():array
+    public function casts(): array
     {
         return [
             'queued_at' => 'datetime',
diff --git a/src/Models/UnsubscribeEventType.php b/src/Models/UnsubscribeEventType.php
index 71f8257d..7d4391b4 100644
--- a/src/Models/UnsubscribeEventType.php
+++ b/src/Models/UnsubscribeEventType.php
@@ -6,10 +6,10 @@ class UnsubscribeEventType extends BaseModel
 {
     protected $table = 'sendportal_unsubscribe_event_types';
 
-    const BOUNCE = 1;
-    const COMPLAINT = 2;
-    const MANUAL_BY_ADMIN = 3;
-    const MANUAL_BY_SUBSCRIBER = 4;
+    public const BOUNCE = 1;
+    public const COMPLAINT = 2;
+    public const MANUAL_BY_ADMIN = 3;
+    public const MANUAL_BY_SUBSCRIBER = 4;
 
     public static $types = [
         1 => 'Bounced',
diff --git a/src/Presenters/CampaignReportPresenter.php b/src/Presenters/CampaignReportPresenter.php
index e059a575..15fa3a79 100644
--- a/src/Presenters/CampaignReportPresenter.php
+++ b/src/Presenters/CampaignReportPresenter.php
@@ -56,7 +56,7 @@ public function __construct(Campaign $campaign, int $currentWorkspaceId, int $in
      */
     public function generate(): array
     {
-        if (!$this->campaign) {
+        if (! $this->campaign) {
             throw new RuntimeException('Campaign must be initialised');
         }
 
diff --git a/src/Providers/EventServiceProvider.php b/src/Providers/EventServiceProvider.php
index 1b6998fb..c5cb2536 100644
--- a/src/Providers/EventServiceProvider.php
+++ b/src/Providers/EventServiceProvider.php
@@ -7,17 +7,17 @@
 use Sendportal\Base\Events\SubscriberAddedEvent;
 use Sendportal\Base\Events\Webhooks\MailgunWebhookReceived;
 use Sendportal\Base\Events\Webhooks\MailjetWebhookReceived;
+use Sendportal\Base\Events\Webhooks\PostalWebhookReceived;
 use Sendportal\Base\Events\Webhooks\PostmarkWebhookReceived;
 use Sendportal\Base\Events\Webhooks\SendgridWebhookReceived;
 use Sendportal\Base\Events\Webhooks\SesWebhookReceived;
-use Sendportal\Base\Events\Webhooks\PostalWebhookReceived;
 use Sendportal\Base\Listeners\MessageDispatchHandler;
 use Sendportal\Base\Listeners\Webhooks\HandleMailgunWebhook;
 use Sendportal\Base\Listeners\Webhooks\HandleMailjetWebhook;
+use Sendportal\Base\Listeners\Webhooks\HandlePostalWebhook;
 use Sendportal\Base\Listeners\Webhooks\HandlePostmarkWebhook;
 use Sendportal\Base\Listeners\Webhooks\HandleSendgridWebhook;
 use Sendportal\Base\Listeners\Webhooks\HandleSesWebhook;
-use Sendportal\Base\Listeners\Webhooks\HandlePostalWebhook;
 
 class EventServiceProvider extends ServiceProvider
 {
diff --git a/src/Providers/ResolverProvider.php b/src/Providers/ResolverProvider.php
index e0e39031..aee65fc8 100644
--- a/src/Providers/ResolverProvider.php
+++ b/src/Providers/ResolverProvider.php
@@ -9,7 +9,6 @@
 
 class ResolverProvider extends ServiceProvider
 {
-
     /**
      * Register any application services.
      *
diff --git a/src/Repositories/BaseEloquentRepository.php b/src/Repositories/BaseEloquentRepository.php
index 7dea3198..2777430c 100644
--- a/src/Repositories/BaseEloquentRepository.php
+++ b/src/Repositories/BaseEloquentRepository.php
@@ -1,4 +1,6 @@
-<?php namespace Sendportal\Base\Repositories;
+<?php
+
+namespace Sendportal\Base\Repositories;
 
 use Sendportal\Base\Interfaces\BaseEloquentInterface;
 
@@ -91,7 +93,7 @@ public function paginate($orderBy = 'name', array $relations = [], $paginate = 2
      */
     protected function applyFilters($instance, array $filters = [])
     {
-        return;
+
     }
 
     /**
@@ -347,7 +349,7 @@ public function getNewInstance()
     {
         $model = $this->getModelName();
 
-        return new $model;
+        return new $model();
     }
 
     /**
diff --git a/src/Repositories/BaseTenantRepository.php b/src/Repositories/BaseTenantRepository.php
index fe443e17..40d9ff22 100644
--- a/src/Repositories/BaseTenantRepository.php
+++ b/src/Repositories/BaseTenantRepository.php
@@ -1,4 +1,6 @@
-<?php namespace Sendportal\Base\Repositories;
+<?php
+
+namespace Sendportal\Base\Repositories;
 
 use Exception;
 use Illuminate\Database\Eloquent\Builder;
@@ -308,7 +310,7 @@ public function count(): int
      */
     public function getModelName(): string
     {
-        if (!$this->modelName) {
+        if (! $this->modelName) {
             throw new RuntimeException('Model has not been set in ' . get_called_class());
         }
 
@@ -332,7 +334,7 @@ public function getNewInstance()
     {
         $model = $this->getModelName();
 
-        return new $model;
+        return new $model();
     }
 
     /**
diff --git a/src/Repositories/EmailServiceTenantRepository.php b/src/Repositories/EmailServiceTenantRepository.php
index e4744b82..f019ee70 100644
--- a/src/Repositories/EmailServiceTenantRepository.php
+++ b/src/Repositories/EmailServiceTenantRepository.php
@@ -7,7 +7,6 @@
 
 class EmailServiceTenantRepository extends BaseTenantRepository
 {
-
     /**
      * @var string
      */
diff --git a/src/Repositories/Messages/BaseMessageTenantRepository.php b/src/Repositories/Messages/BaseMessageTenantRepository.php
index ecfe8347..7c06fb0d 100644
--- a/src/Repositories/Messages/BaseMessageTenantRepository.php
+++ b/src/Repositories/Messages/BaseMessageTenantRepository.php
@@ -37,7 +37,7 @@ public function paginateWithSource(int $workspaceId, string $orderBy = 'name', a
                 }
             ]);
 
-        $instance->when(!Helper::isPro(), function ($q) {
+        $instance->when(! Helper::isPro(), function ($q) {
             $q->where('source_type', '=', Campaign::class);
         });
 
diff --git a/src/Repositories/Messages/PostgresMessageTenantRepository.php b/src/Repositories/Messages/PostgresMessageTenantRepository.php
index 5eec6a37..869678f5 100644
--- a/src/Repositories/Messages/PostgresMessageTenantRepository.php
+++ b/src/Repositories/Messages/PostgresMessageTenantRepository.php
@@ -15,12 +15,12 @@ class PostgresMessageTenantRepository extends BaseMessageTenantRepository
     public function countUniqueOpensPerPeriod(int $workspaceId, string $sourceType, int $sourceId, int $intervalInSeconds): Collection
     {
         return DB::table('sendportal_messages')
-            ->selectRaw("COUNT(*) as open_count, MIN(opened_at) as opened_at, to_char(to_timestamp(floor(extract('epoch' from opened_at) / $intervalInSeconds) * $intervalInSeconds),'YYYY-MM-DD HH24:MI:SS') as period_start")
+            ->selectRaw("COUNT(*) as open_count, MIN(opened_at) as opened_at, to_char(to_timestamp(floor(extract('epoch' from opened_at) / {$intervalInSeconds}) * {$intervalInSeconds}),'YYYY-MM-DD HH24:MI:SS') as period_start")
             ->where('workspace_id', $workspaceId)
             ->where('source_type', $sourceType)
             ->where('source_id', $sourceId)
             ->whereNotNull('opened_at')
-            ->groupByRaw("floor(extract('epoch' from opened_at) / $intervalInSeconds)")
+            ->groupByRaw("floor(extract('epoch' from opened_at) / {$intervalInSeconds})")
             ->orderBy('opened_at')
             ->get();
     }
diff --git a/src/Repositories/Subscribers/BaseSubscriberTenantRepository.php b/src/Repositories/Subscribers/BaseSubscriberTenantRepository.php
index f11cad0f..dcbe0f6c 100644
--- a/src/Repositories/Subscribers/BaseSubscriberTenantRepository.php
+++ b/src/Repositories/Subscribers/BaseSubscriberTenantRepository.php
@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace Sendportal\Base\Repositories\Subscribers;
diff --git a/src/Routes/WebRoutes.php b/src/Routes/WebRoutes.php
index cc796f86..bbb2a57d 100644
--- a/src/Routes/WebRoutes.php
+++ b/src/Routes/WebRoutes.php
@@ -46,7 +46,6 @@ public function sendportalWebRoutes(): callable
             $this->name('sendportal.')->namespace('\Sendportal\Base\Http\Controllers')->group(static function (
                 Router $appRouter
             ) {
-
                 // Dashboard.
                 $appRouter->get('/', 'DashboardController@index')->name('dashboard');
 
diff --git a/src/Rules/CanAccessSubscriber.php b/src/Rules/CanAccessSubscriber.php
index 0cc9735e..7d301cd5 100644
--- a/src/Rules/CanAccessSubscriber.php
+++ b/src/Rules/CanAccessSubscriber.php
@@ -14,7 +14,7 @@ public function passes($attribute, $value): bool
     {
         $subscriber = Subscriber::find($value);
 
-        if (!$subscriber) {
+        if (! $subscriber) {
             return false;
         }
 
diff --git a/src/Rules/CanAccessTag.php b/src/Rules/CanAccessTag.php
index 02ce84b4..c75878d2 100644
--- a/src/Rules/CanAccessTag.php
+++ b/src/Rules/CanAccessTag.php
@@ -14,7 +14,7 @@ public function passes($attribute, $value): bool
     {
         $tag = Tag::find($value);
 
-        if (!$tag) {
+        if (! $tag) {
             return false;
         }
 
diff --git a/src/Services/Content/MergeContentService.php b/src/Services/Content/MergeContentService.php
index ac895365..27d422bf 100644
--- a/src/Services/Content/MergeContentService.php
+++ b/src/Services/Content/MergeContentService.php
@@ -62,7 +62,7 @@ protected function mergeCampaignContent(Message $message): string
         /** @var Campaign $campaign */
         $campaign = $this->campaignRepo->find($message->workspace_id, $message->source_id, ['template']);
 
-        if (!$campaign) {
+        if (! $campaign) {
             throw new Exception('Unable to resolve campaign step for message id= ' . $message->id);
         }
 
@@ -76,15 +76,15 @@ protected function mergeCampaignContent(Message $message): string
      */
     protected function mergeAutomationContent(Message $message): string
     {
-        if (!$schedule = app(AutomationScheduleRepository::class)->find($message->source_id, ['automation_step'])) {
+        if (! $schedule = app(AutomationScheduleRepository::class)->find($message->source_id, ['automation_step'])) {
             throw new Exception('Unable to resolve automation step for message id=' . $message->id);
         }
 
-        if (!$content = $schedule->automation_step->content) {
+        if (! $content = $schedule->automation_step->content) {
             throw new Exception('Unable to resolve content for automation step id=' . $schedule->automation_step_id);
         }
 
-        if (!$template = $schedule->automation_step->template) {
+        if (! $template = $schedule->automation_step->template) {
             throw new Exception('Unable to resolve template for automation step id=' . $schedule->automation_step_id);
         }
 
diff --git a/src/Services/Helper.php b/src/Services/Helper.php
index 7f1d80c0..a68f73be 100644
--- a/src/Services/Helper.php
+++ b/src/Services/Helper.php
@@ -6,7 +6,6 @@
 
 class Helper
 {
-
     /**
      * Display a given date in the active user's timezone.
      *
@@ -16,7 +15,7 @@ class Helper
      */
     public function displayDate($date, string $timezone = null)
     {
-        if (!$date) {
+        if (! $date) {
             return null;
         }
 
diff --git a/src/Services/Messages/DispatchMessage.php b/src/Services/Messages/DispatchMessage.php
index 584cdaf4..85920216 100644
--- a/src/Services/Messages/DispatchMessage.php
+++ b/src/Services/Messages/DispatchMessage.php
@@ -49,7 +49,7 @@ public function __construct(
      */
     public function handle(Message $message): ?string
     {
-        if (!$this->isValidMessage($message)) {
+        if (! $this->isValidMessage($message)) {
             Log::info('Message is not valid, skipping id=' . $message->id);
 
             return null;
@@ -96,7 +96,7 @@ protected function getMergedContent(Message $message): string
      */
     protected function dispatch(Message $message, EmailService $emailService, MessageTrackingOptions $trackingOptions, string $mergedContent): ?string
     {
-        $messageOptions = (new MessageOptions)
+        $messageOptions = (new MessageOptions())
             ->setTo($message->recipient_email)
             ->setFromEmail($message->from_email)
             ->setFromName($message->from_name)
@@ -129,13 +129,13 @@ protected function isValidMessage(Message $message): bool
             return false;
         }
 
-        if (!$message->isCampaign()) {
+        if (! $message->isCampaign()) {
             return true;
         }
 
         $campaign = Campaign::find($message->source_id);
 
-        if (!$campaign) {
+        if (! $campaign) {
             return false;
         }
 
diff --git a/src/Services/Messages/DispatchTestMessage.php b/src/Services/Messages/DispatchTestMessage.php
index d6498fdb..d28a489a 100644
--- a/src/Services/Messages/DispatchTestMessage.php
+++ b/src/Services/Messages/DispatchTestMessage.php
@@ -45,7 +45,7 @@ public function handle(int $workspaceId, int $campaignId, string $recipientEmail
     {
         $campaign = $this->resolveCampaign($workspaceId, $campaignId);
 
-        if (!$campaign) {
+        if (! $campaign) {
             Log::error(
                 'Unable to get campaign to send test message.',
                 ['workspace_id' => $workspaceId, 'campaign_id' => $campaignId]
@@ -104,7 +104,7 @@ protected function getMergedContent(Message $message): string
      */
     protected function dispatch(Message $message, EmailService $emailService, MessageTrackingOptions $trackingOptions, string $mergedContent): ?string
     {
-        $messageOptions = (new MessageOptions)
+        $messageOptions = (new MessageOptions())
             ->setTo($message->recipient_email)
             ->setFromEmail($message->from_email)
             ->setFromName($message->from_name)
diff --git a/src/Services/Messages/MessageTrackingOptions.php b/src/Services/Messages/MessageTrackingOptions.php
index 6ff1f7e3..dfcfbffb 100644
--- a/src/Services/Messages/MessageTrackingOptions.php
+++ b/src/Services/Messages/MessageTrackingOptions.php
@@ -20,7 +20,7 @@ public static function fromMessage(Message $message): MessageTrackingOptions
         // NOTE(david): at the moment only campaigns have the ability to turn off tracking, so we start
         // by creating a default set of options that has the tracking on, and only look to adjust that
         // if the message we've got is for a campaign.
-        $trackingOptions = new static;
+        $trackingOptions = new static();
 
         if ($message->source && get_class($message->source) === Campaign::class) {
             return static::fromCampaign($message->source);
@@ -31,7 +31,7 @@ public static function fromMessage(Message $message): MessageTrackingOptions
 
     public static function fromCampaign(Campaign $campaign): MessageTrackingOptions
     {
-        return (new static)
+        return (new static())
             ->setIsOpenTracking($campaign->is_open_tracking ?? true)
             ->setIsClickTracking($campaign->is_click_tracking ?? true);
     }
diff --git a/src/Services/Messages/ResolveEmailService.php b/src/Services/Messages/ResolveEmailService.php
index aceab74e..71953750 100644
--- a/src/Services/Messages/ResolveEmailService.php
+++ b/src/Services/Messages/ResolveEmailService.php
@@ -43,14 +43,14 @@ public function handle(Message $message): EmailService
      */
     protected function resolveAutomationEmailService(Message $message): EmailService
     {
-        if (!$automationSchedule = app(AutomationScheduleRepository::class)->find(
+        if (! $automationSchedule = app(AutomationScheduleRepository::class)->find(
             $message->source_id,
             ['automation_step.automation.email_service.type']
         )) {
             throw new Exception('Unable to resolve automation schedule for message id=' . $message->id);
         }
 
-        if (!$emailService = $automationSchedule->automation_step->automation->email_service) {
+        if (! $emailService = $automationSchedule->automation_step->automation->email_service) {
             throw new Exception('Unable to resolve email service for message id=' . $message->id);
         }
 
diff --git a/src/Services/Sendportal.php b/src/Services/Sendportal.php
index 7997d968..1ca23091 100644
--- a/src/Services/Sendportal.php
+++ b/src/Services/Sendportal.php
@@ -24,7 +24,7 @@ public function publicApiRoutes(): void
     {
         $this->app->make('router')->sendportalPublicApiRoutes();
     }
-    
+
     /**
      * @throws BindingResolutionException
      */
diff --git a/src/Services/Subscribers/ApiSubscriberService.php b/src/Services/Subscribers/ApiSubscriberService.php
index 58e5f105..6e4646d3 100644
--- a/src/Services/Subscribers/ApiSubscriberService.php
+++ b/src/Services/Subscribers/ApiSubscriberService.php
@@ -31,7 +31,7 @@ public function storeOrUpdate(int $workspaceId, Collection $data): Subscriber
     {
         $existingSubscriber = $this->subscribers->findBy($workspaceId, 'email', $data['email']);
 
-        if (!$existingSubscriber) {
+        if (! $existingSubscriber) {
             $subscriber = $this->subscribers->store($workspaceId, $data->toArray());
 
             event(new SubscriberAddedEvent($subscriber));
diff --git a/src/Services/Subscribers/ImportSubscriberService.php b/src/Services/Subscribers/ImportSubscriberService.php
index 649d1433..8fc9e392 100644
--- a/src/Services/Subscribers/ImportSubscriberService.php
+++ b/src/Services/Subscribers/ImportSubscriberService.php
@@ -24,15 +24,15 @@ public function import(int $workspaceId, array $data): Subscriber
     {
         $subscriber = null;
 
-        if (!empty(Arr::get($data, 'id'))) {
+        if (! empty(Arr::get($data, 'id'))) {
             $subscriber = $this->subscribers->findBy($workspaceId, 'id', $data['id'], ['tags']);
         }
 
-        if (!$subscriber) {
+        if (! $subscriber) {
             $subscriber = $this->subscribers->findBy($workspaceId, 'email', Arr::get($data, 'email'), ['tags']);
         }
 
-        if (!$subscriber) {
+        if (! $subscriber) {
             $subscriber = $this->subscribers->store($workspaceId, Arr::except($data, ['id', 'tags']));
         }
 
diff --git a/src/Services/Tags/ApiTagService.php b/src/Services/Tags/ApiTagService.php
index 536f5363..73688503 100644
--- a/src/Services/Tags/ApiTagService.php
+++ b/src/Services/Tags/ApiTagService.php
@@ -28,7 +28,7 @@ public function store(int $workspaceId, Collection $data): Tag
     {
         $tag = $this->tags->store($workspaceId, $data->except('subscribers')->toArray());
 
-        if (!empty($data['subscribers'])) {
+        if (! empty($data['subscribers'])) {
             $tag->subscribers()->attach($data['subscribers']);
         }
 
diff --git a/src/Services/Webhooks/EmailWebhookService.php b/src/Services/Webhooks/EmailWebhookService.php
index e464cdd9..3fa5f8a5 100644
--- a/src/Services/Webhooks/EmailWebhookService.php
+++ b/src/Services/Webhooks/EmailWebhookService.php
@@ -33,11 +33,11 @@ public function handleOpen(string $messageId, Carbon $timestamp, ?string $ipAddr
         /** @var Message $message */
         $message = Message::where('message_id', $messageId)->first();
 
-        if (!$message) {
+        if (! $message) {
             return;
         }
 
-        if (!$message->opened_at) {
+        if (! $message->opened_at) {
             $message->opened_at = $timestamp;
             $message->ip = $ipAddress;
         }
@@ -60,7 +60,7 @@ public function handleClick(string $messageId, Carbon $timestamp, ?string $url):
         /* @var Message $message */
         $message = Message::where('message_id', $messageId)->first();
 
-        if (!$message) {
+        if (! $message) {
             return;
         }
 
@@ -69,13 +69,13 @@ public function handleClick(string $messageId, Carbon $timestamp, ?string $url):
             return;
         }
 
-        if (!$message->clicked_at) {
+        if (! $message->clicked_at) {
             $message->clicked_at = $timestamp;
         }
 
         // Since you have to open a campaign to click a link inside it, we'll consider those clicks as opens
         // even if the tracking image didn't load.
-        if (!$message->opened_at) {
+        if (! $message->opened_at) {
             ++$message->open_count;
             $message->opened_at = $timestamp;
         }
@@ -111,11 +111,11 @@ public function handleComplaint(string $messageId, Carbon $timestamp): void
         /* @var Message $message */
         $message = Message::where('message_id', $messageId)->first();
 
-        if (!$message) {
+        if (! $message) {
             return;
         }
 
-        if (!$message->complained_at) {
+        if (! $message->complained_at) {
             $message->unsubscribed_at = $timestamp;
             $message->save();
         }
@@ -128,11 +128,11 @@ public function handlePermanentBounce($messageId, $timestamp): void
         /* @var Message $message */
         $message = Message::where('message_id', $messageId)->first();
 
-        if (!$message) {
+        if (! $message) {
             return;
         }
 
-        if (!$message->bounced_at) {
+        if (! $message->bounced_at) {
             $message->bounced_at = $timestamp;
             $message->save();
         }
@@ -145,7 +145,7 @@ public function handleFailure($messageId, $severity, $description, $timestamp):
         /* @var Message $message */
         $message = Message::where('message_id', $messageId)->first();
 
-        if (!$message) {
+        if (! $message) {
             return;
         }
 
@@ -165,7 +165,7 @@ protected function unsubscribe(string $messageId, int $typeId): void
     {
         $subscriberId = DB::table('sendportal_messages')->where('message_id', $messageId)->value('subscriber_id');
 
-        if (!$subscriberId) {
+        if (! $subscriberId) {
             return;
         }
 
@@ -190,7 +190,7 @@ protected function resolveAutomationStepFromMessage(Message $message)
 
         $automationSchedule = DB::table('sendportal_automation_schedules')->where('id', $message->source_id)->first();
 
-        if (!$automationSchedule) {
+        if (! $automationSchedule) {
             throw new RuntimeException('Unable to find schedule matching message source id=' . $message->source_id);
         }
 
diff --git a/tests/Feature/API/CampaignsControllerTest.php b/tests/Feature/API/CampaignsControllerTest.php
index 61e515f9..0d2c7aa2 100644
--- a/tests/Feature/API/CampaignsControllerTest.php
+++ b/tests/Feature/API/CampaignsControllerTest.php
@@ -14,8 +14,8 @@
 
 class CampaignsControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function a_list_of_a_workspaces_campaigns_can_be_retrieved()
diff --git a/tests/Feature/API/SubscriberTagsControllerTest.php b/tests/Feature/API/SubscriberTagsControllerTest.php
index 3b468439..6f03a005 100644
--- a/tests/Feature/API/SubscriberTagsControllerTest.php
+++ b/tests/Feature/API/SubscriberTagsControllerTest.php
@@ -11,8 +11,8 @@
 
 class SubscriberTagsControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function can_retrieve_a_list_of_a_subscribers_tags()
diff --git a/tests/Feature/API/SubscribersControllerTest.php b/tests/Feature/API/SubscribersControllerTest.php
index dca926ca..778caf9f 100644
--- a/tests/Feature/API/SubscribersControllerTest.php
+++ b/tests/Feature/API/SubscribersControllerTest.php
@@ -14,8 +14,8 @@
 
 class SubscribersControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function the_subscribers_index_is_accessible_to_authorised_users()
diff --git a/tests/Feature/API/TagSubscribersControllerTest.php b/tests/Feature/API/TagSubscribersControllerTest.php
index e5d96905..9463b9ea 100644
--- a/tests/Feature/API/TagSubscribersControllerTest.php
+++ b/tests/Feature/API/TagSubscribersControllerTest.php
@@ -11,8 +11,8 @@
 
 class TagSubscribersControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function the_index_gets_tag_subscribers()
diff --git a/tests/Feature/API/TagsControllerTest.php b/tests/Feature/API/TagsControllerTest.php
index b4fbd08b..745a032f 100644
--- a/tests/Feature/API/TagsControllerTest.php
+++ b/tests/Feature/API/TagsControllerTest.php
@@ -13,8 +13,8 @@
 
 class TagsControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function a_list_of_a_workspaces_tags_can_be_retrieved()
diff --git a/tests/Feature/API/TemplatesControllerTest.php b/tests/Feature/API/TemplatesControllerTest.php
index 62255497..53db605f 100644
--- a/tests/Feature/API/TemplatesControllerTest.php
+++ b/tests/Feature/API/TemplatesControllerTest.php
@@ -15,9 +15,9 @@
 
 class TemplatesControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker,
-        NormalizeTags;
+    use RefreshDatabase;
+    use WithFaker;
+    use NormalizeTags;
 
     /** @test */
     public function the_template_index_is_accessible_to_authorised_users()
diff --git a/tests/Feature/Campaigns/CampaignControllerTest.php b/tests/Feature/Campaigns/CampaignControllerTest.php
index 27f5619a..ef7dbf0c 100644
--- a/tests/Feature/Campaigns/CampaignControllerTest.php
+++ b/tests/Feature/Campaigns/CampaignControllerTest.php
@@ -15,8 +15,8 @@
 
 class CampaignControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function the_index_of_campaigns_is_accessible_to_authenticated_users()
diff --git a/tests/Feature/Content/MergeContentTest.php b/tests/Feature/Content/MergeContentTest.php
index 509c4267..1782079e 100644
--- a/tests/Feature/Content/MergeContentTest.php
+++ b/tests/Feature/Content/MergeContentTest.php
@@ -16,8 +16,8 @@
 
 class MergeContentTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function campaign_content_can_be_merged()
diff --git a/tests/Feature/Content/MergeSubjectTest.php b/tests/Feature/Content/MergeSubjectTest.php
index c1fee4a0..bf6b7309 100644
--- a/tests/Feature/Content/MergeSubjectTest.php
+++ b/tests/Feature/Content/MergeSubjectTest.php
@@ -15,8 +15,8 @@
 
 class MergeSubjectTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function the_email_tag_is_replaced_with_the_subscriber_email()
diff --git a/tests/Feature/EmailServices/EmailServicesControllerTest.php b/tests/Feature/EmailServices/EmailServicesControllerTest.php
index 9cf21e64..f436cae1 100644
--- a/tests/Feature/EmailServices/EmailServicesControllerTest.php
+++ b/tests/Feature/EmailServices/EmailServicesControllerTest.php
@@ -15,8 +15,8 @@
 
 class EmailServicesControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function the_provider_create_form_is_accessible_to_authenticated_users()
diff --git a/tests/Feature/Subscribers/SubscribersControllerTest.php b/tests/Feature/Subscribers/SubscribersControllerTest.php
index 2708d26b..b9b069d8 100644
--- a/tests/Feature/Subscribers/SubscribersControllerTest.php
+++ b/tests/Feature/Subscribers/SubscribersControllerTest.php
@@ -13,8 +13,8 @@
 
 class SubscribersControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function new_subscribers_can_be_created_by_authenticated_users()
diff --git a/tests/Feature/Subscribers/SubscribersImportControllerTest.php b/tests/Feature/Subscribers/SubscribersImportControllerTest.php
index 2be643d5..974c55c0 100644
--- a/tests/Feature/Subscribers/SubscribersImportControllerTest.php
+++ b/tests/Feature/Subscribers/SubscribersImportControllerTest.php
@@ -15,8 +15,8 @@
 
 class SubscribersImportControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     public function setUp(): void
     {
diff --git a/tests/Feature/Tags/TagsControllerTest.php b/tests/Feature/Tags/TagsControllerTest.php
index 1e401931..5fde9e67 100644
--- a/tests/Feature/Tags/TagsControllerTest.php
+++ b/tests/Feature/Tags/TagsControllerTest.php
@@ -13,8 +13,8 @@
 
 class TagsControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function the_index_of_tags_is_accessible_to_authenticated_users()
diff --git a/tests/Feature/Templates/TemplatesControllerTest.php b/tests/Feature/Templates/TemplatesControllerTest.php
index a8488af2..53b110cd 100644
--- a/tests/Feature/Templates/TemplatesControllerTest.php
+++ b/tests/Feature/Templates/TemplatesControllerTest.php
@@ -13,8 +13,8 @@
 
 class TemplatesControllerTest extends TestCase
 {
-    use RefreshDatabase,
-        WithFaker;
+    use RefreshDatabase;
+    use WithFaker;
 
     /** @test */
     public function a_logged_in_user_can_see_template_index()
@@ -166,7 +166,7 @@ public function updates_are_validated()
 
         // when
         $namePostResponse = $this->put(route('sendportal.templates.update', $template->id), $namePostData);
-        
+
         // then
         $namePostResponse->assertSessionHasErrors('content');
 
diff --git a/tests/Feature/Webhooks/AwsWebhooksTest.php b/tests/Feature/Webhooks/AwsWebhooksTest.php
index 4cf4e4d3..dfbabbe7 100644
--- a/tests/Feature/Webhooks/AwsWebhooksTest.php
+++ b/tests/Feature/Webhooks/AwsWebhooksTest.php
@@ -134,8 +134,8 @@ protected function resolveWebhook(string $type, string $messageId, array $proper
             'Message' => json_encode(
                 [
                     $type => [
-                            'timestamp' => now()->timestamp,
-                        ] + $properties,
+                        'timestamp' => now()->timestamp,
+                    ] + $properties,
                     'eventType' => $type,
                     'mail' => [
                         'messageId' => $messageId,
diff --git a/tests/Unit/Services/Messages/MessageTrackingOptionsTest.php b/tests/Unit/Services/Messages/MessageTrackingOptionsTest.php
index d995e8d6..455f5cd5 100644
--- a/tests/Unit/Services/Messages/MessageTrackingOptionsTest.php
+++ b/tests/Unit/Services/Messages/MessageTrackingOptionsTest.php
@@ -26,7 +26,7 @@ public function default_tracking_options_are_on()
     public function open_tracking_can_be_turned_off()
     {
         // given
-        $trackingOptions = (new MessageTrackingOptions)->setIsOpenTracking(false);
+        $trackingOptions = (new MessageTrackingOptions())->setIsOpenTracking(false);
 
         // then
         self::assertFalse($trackingOptions->isOpenTracking());
@@ -36,7 +36,7 @@ public function open_tracking_can_be_turned_off()
     public function click_tracking_can_be_turned_off()
     {
         // given
-        $trackingOptions = (new MessageTrackingOptions)->setIsClickTracking(false);
+        $trackingOptions = (new MessageTrackingOptions())->setIsClickTracking(false);
 
         // then
         self::assertFalse($trackingOptions->isClickTracking());
@@ -46,7 +46,7 @@ public function click_tracking_can_be_turned_off()
     public function tracking_can_be_turned_off_entirely()
     {
         // given
-        $trackingOptions = (new MessageTrackingOptions)->disable();
+        $trackingOptions = (new MessageTrackingOptions())->disable();
 
         // then
         $this->assertFalse($trackingOptions->isClickTracking());