Clean up code.

This commit is contained in:
James Cole
2024-12-14 07:22:46 +01:00
parent b3560ff525
commit 5f1502eea7
30 changed files with 432 additions and 505 deletions

View File

@@ -45,11 +45,7 @@ class OwnerTestNotificationEmail extends Notification
}
/**
* Get the array representation of the notification.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function toArray(OwnerNotifiable $notifiable)
{
@@ -58,13 +54,7 @@ class OwnerTestNotificationEmail extends Notification
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return MailMessage
*/
public function toMail(OwnerNotifiable $notifiable)
{
@@ -72,18 +62,11 @@ class OwnerTestNotificationEmail extends Notification
return (new MailMessage())
->markdown('emails.admin-test', ['email' => $address])
->subject((string) trans('email.admin_test_subject'))
;
->subject((string) trans('email.admin_test_subject'));
}
/**
* Get the notification's delivery channels.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @param mixed $notifiable
*
* @return array
*/
public function via(OwnerNotifiable $notifiable)
{

View File

@@ -49,13 +49,7 @@ class OwnerTestNotificationNtfy extends Notification
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function toArray($notifiable)
{
@@ -63,6 +57,9 @@ class OwnerTestNotificationNtfy extends Notification
];
}
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function toNtfy(OwnerNotifiable $notifiable): Message
{
$settings = ReturnsSettings::getSettings('ntfy', 'owner', null);

View File

@@ -49,11 +49,7 @@ class OwnerTestNotificationPushover extends Notification
}
/**
* Get the array representation of the notification.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function toArray(OwnerNotifiable $notifiable)
{
@@ -61,13 +57,15 @@ class OwnerTestNotificationPushover extends Notification
];
}
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
{
Log::debug('Now in toPushover()');
return PushoverMessage::create((string)trans('email.admin_test_message', ['channel' => 'Pushover']))
->title((string)trans('email.admin_test_subject'))
;
return PushoverMessage::create((string) trans('email.admin_test_message', ['channel' => 'Pushover']))
->title((string) trans('email.admin_test_subject'));
}
/**

View File

@@ -47,11 +47,7 @@ class OwnerTestNotificationSlack extends Notification
}
/**
* Get the array representation of the notification.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function toArray(OwnerNotifiable $notifiable)
{
@@ -60,8 +56,6 @@ class OwnerTestNotificationSlack extends Notification
}
/**
* Get the Slack representation of the notification.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function toSlack(OwnerNotifiable $notifiable)
@@ -71,11 +65,7 @@ class OwnerTestNotificationSlack extends Notification
}
/**
* Get the notification's delivery channels.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function via(OwnerNotifiable $notifiable)
{

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Notifications\Test;
use FireflyIII\Notifications\Notifiables\OwnerNotifiable;
use FireflyIII\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
@@ -46,11 +45,7 @@ class UserTestNotificationEmail extends Notification
}
/**
* Get the array representation of the notification.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function toArray(User $notifiable)
{
@@ -58,33 +53,18 @@ class UserTestNotificationEmail extends Notification
];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return MailMessage
*/
public function toMail(User $notifiable)
{
$address = (string) $notifiable->email;
return (new MailMessage())
->markdown('emails.admin-test', ['email' => $address])
->subject((string) trans('email.admin_test_subject'))
;
->subject((string) trans('email.admin_test_subject'));
}
/**
* Get the notification's delivery channels.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @param User $notifiable
*
* @return array
*/
public function via(User $notifiable)
{

View File

@@ -49,13 +49,7 @@ class UserTestNotificationNtfy extends Notification
}
/**
* Get the array representation of the notification.
*
* @param User $notifiable
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function toArray(User $notifiable)
{
@@ -63,10 +57,13 @@ class UserTestNotificationNtfy extends Notification
];
}
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function toNtfy(User $user): Message
{
$settings = ReturnsSettings::getSettings('ntfy', 'user', $user);
$message = new Message();
$message = new Message();
$message->topic($settings['ntfy_topic']);
$message->title((string) trans('email.admin_test_subject'));
$message->body((string) trans('email.admin_test_message', ['channel' => 'ntfy']));

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Notifications\Test;
use FireflyIII\Notifications\Notifiables\OwnerNotifiable;
use FireflyIII\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
@@ -50,11 +49,7 @@ class UserTestNotificationPushover extends Notification
}
/**
* Get the array representation of the notification.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function toArray(User $notifiable)
{
@@ -62,13 +57,15 @@ class UserTestNotificationPushover extends Notification
];
}
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function toPushover(User $notifiable): PushoverMessage
{
Log::debug('Now in (user) toPushover()');
return PushoverMessage::create((string)trans('email.admin_test_message', ['channel' => 'Pushover']))
->title((string)trans('email.admin_test_subject'))
;
return PushoverMessage::create((string) trans('email.admin_test_message', ['channel' => 'Pushover']))
->title((string) trans('email.admin_test_subject'));
}
/**

View File

@@ -40,18 +40,16 @@ class UserTestNotificationSlack extends Notification
private OwnerNotifiable $owner;
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(OwnerNotifiable $owner)
{
$this->owner = $owner;
}
/**
* Get the array representation of the notification.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function toArray(OwnerNotifiable $notifiable)
{
@@ -60,8 +58,6 @@ class UserTestNotificationSlack extends Notification
}
/**
* Get the Slack representation of the notification.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function toSlack(OwnerNotifiable $notifiable)
@@ -71,11 +67,7 @@ class UserTestNotificationSlack extends Notification
}
/**
* Get the notification's delivery channels.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
*/
public function via(OwnerNotifiable $notifiable)
{