Code cleanup.

This commit is contained in:
James Cole
2023-12-20 19:35:52 +01:00
parent c4f6366642
commit 64ec0cf62e
997 changed files with 12908 additions and 28136 deletions

View File

@@ -40,8 +40,6 @@ class NewAccessToken extends Notification
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct() {}
@@ -51,12 +49,12 @@ class NewAccessToken extends Notification
* @param mixed $notifiable
*
* @return array
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function toArray($notifiable)
{
return [
//
];
}
@@ -66,13 +64,15 @@ class NewAccessToken extends Notification
* @param mixed $notifiable
*
* @return MailMessage
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function toMail($notifiable)
{
return (new MailMessage())
->markdown('emails.token-created')
->subject((string)trans('email.access_token_created_subject'));
->subject((string)trans('email.access_token_created_subject'))
;
}
/**
@@ -81,6 +81,7 @@ class NewAccessToken extends Notification
* @param mixed $notifiable
*
* @return SlackMessage
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function toSlack($notifiable)
@@ -94,11 +95,12 @@ class NewAccessToken extends Notification
* @param mixed $notifiable
*
* @return array
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function via($notifiable)
{
/** @var User|null $user */
/** @var null|User $user */
$user = auth()->user();
$slackUrl = null === $user ? '' : app('preferences')->getForUser(auth()->user(), 'slack_webhook_url', '')->data;
if (is_array($slackUrl)) {
@@ -107,6 +109,7 @@ class NewAccessToken extends Notification
if (UrlValidator::isValidWebhookURL((string)$slackUrl)) {
return ['mail', 'slack'];
}
return ['mail'];
}
}