Various PSR12 code cleanup

This commit is contained in:
James Cole
2022-12-29 19:42:26 +01:00
parent dbf3e76ecc
commit 6cfdc58cb1
415 changed files with 7462 additions and 6874 deletions

View File

@@ -38,8 +38,8 @@ class BillReminder extends Notification
use Queueable;
private Bill $bill;
private string $field;
private int $diff;
private string $field;
/**
* Create a new notification instance.
@@ -54,27 +54,29 @@ class BillReminder extends Notification
}
/**
* Get the notification's delivery channels.
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
public function toArray($notifiable)
{
return ['mail', 'slack'];
return [
//
];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail($notifiable)
{
$subject = (string) trans(sprintf('email.bill_warning_subject_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
$subject = (string)trans(sprintf('email.bill_warning_subject_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
if (0 === $this->diff) {
$subject = (string) trans(sprintf('email.bill_warning_subject_now_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
$subject = (string)trans(sprintf('email.bill_warning_subject_now_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
}
return (new MailMessage())
@@ -85,35 +87,33 @@ class BillReminder extends Notification
/**
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
* @param mixed $notifiable
* @return SlackMessage
*/
public function toSlack($notifiable)
{
$message = (string) trans(sprintf('email.bill_warning_subject_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
$message = (string)trans(sprintf('email.bill_warning_subject_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
if (0 === $this->diff) {
$message = (string) trans(sprintf('email.bill_warning_subject_now_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
$message = (string)trans(sprintf('email.bill_warning_subject_now_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
}
$bill = $this->bill;
$url = route('bills.show', [$bill->id]);
return (new SlackMessage())
->warning()
->attachment(function ($attachment) use ($bill, $url) {
$attachment->title((string) trans('firefly.visit_bill', ['name' => $bill->name]), $url);
$attachment->title((string)trans('firefly.visit_bill', ['name' => $bill->name]), $url);
})
->content($message);
}
/**
* Get the array representation of the notification.
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
public function via($notifiable)
{
return [
//
];
return ['mail', 'slack'];
}
}