Completed
Push — 2.4 ( c6e444...d8c2c9 )
by James
97:33 queued 36:20
created

ManageSubscriptionNotification   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A via() 0 4 1
A toMail() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of Cachet.
5
 *
6
 * (c) Alt Three Services Limited
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CachetHQ\Cachet\Notifications\Subscriber;
13
14
use Illuminate\Bus\Queueable;
15
use Illuminate\Notifications\Messages\MailMessage;
16
use Illuminate\Notifications\Notification;
17
use Illuminate\Support\Facades\URL;
18
19
class ManageSubscriptionNotification extends Notification
20
{
21
    use Queueable;
22
23
    /**
24
     * Get the notification's delivery channels.
25
     *
26
     * @param mixed $notifiable
27
     *
28
     * @return array
0 ignored issues
show
Documentation introduced by James Brooks
Consider making the return type a bit more specific; maybe use string[].

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
29
     */
30
    public function via($notifiable)
0 ignored issues
show
Unused Code introduced by James Brooks
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31
    {
32
        return ['mail'];
33
    }
34
35
    /**
36
     * Get the mail representation of the notification.
37
     *
38
     * @param mixed $notifiable
39
     *
40
     * @return \Illuminate\Notifications\Messages\MailMessage
41
     */
42
    public function toMail($notifiable)
43
    {
44
        $route = URL::signedRoute(cachet_route_generator('subscribe.manage'), ['code' => $notifiable->verify_code]);
45
46
        return (new MailMessage())
47
                    ->subject(trans('notifications.subscriber.manage.mail.subject'))
48
                    ->greeting(trans('notifications.subscriber.manage.mail.title', ['app_name' => setting('app_name')]))
49
                    ->action(trans('notifications.subscriber.manage.mail.action'), $route)
50
                    ->line(trans('notifications.subscriber.manage.mail.content', ['app_name' => setting('app_name')]));
51
    }
52
}
53