ActivateYourAccount   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 54
c 2
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A via() 0 4 1
A toMail() 0 14 1
1
<?php namespace Anomaly\UsersModule\User\Notification;
2
3
use Anomaly\Streams\Platform\Notification\Message\MailMessage;
4
use Anomaly\UsersModule\User\Contract\UserInterface;
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Notifications\Notification;
7
8
/**
9
 * Class ActivateYourAccount
10
 *
11
 * @link          http://pyrocms.com/
12
 * @author        PyroCMS, Inc. <[email protected]>
13
 * @author        Ryan Thompson <[email protected]>
14
 */
15
class ActivateYourAccount extends Notification
16
{
17
18
    use Queueable;
19
20
    /**
21
     * Redirect here after activating.
22
     *
23
     * @var string
24
     */
25
    public $redirect;
26
27
    /**
28
     * Create a new UserHasRegistered instance.
29
     *
30
     * @param $redirect
31
     */
32
    public function __construct($redirect = '/')
33
    {
34
        $this->redirect = $redirect;
35
    }
36
37
    /**
38
     * Get the notification's delivery channels.
39
     *
40
     * @param  UserInterface $notifiable
41
     * @return array
42
     */
43
    public function via(UserInterface $notifiable)
44
    {
45
        return ['mail'];
46
    }
47
48
    /**
49
     * Return the mail message.
50
     *
51
     * @param  UserInterface $notifiable
52
     * @return MailMessage
53
     */
54
    public function toMail(UserInterface $notifiable)
55
    {
56
        $data = $notifiable->toArray();
57
58
        return (new MailMessage())
59
            ->view('anomaly.module.users::notifications.activate_your_account')
60
            ->subject(trans('anomaly.module.users::notification.activate_your_account.subject', $data))
61
            ->greeting(trans('anomaly.module.users::notification.activate_your_account.greeting', $data))
62
            ->line(trans('anomaly.module.users::notification.activate_your_account.instructions', $data))
63
            ->action(
64
                trans('anomaly.module.users::notification.activate_your_account.button', $data),
65
                $notifiable->route('activate', ['redirect' => $this->redirect])
66
            );
67
    }
68
}
69