Completed
Push — master ( f06f41...6c4f3d )
by Ryan
02:40
created

UserPendingActivation::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php namespace Anomaly\UsersModule\User\Notification;
2
3
use Illuminate\Notifications\Notifiable;
4
use Illuminate\Notifications\Notification;
5
use Illuminate\Notifications\Messages\SlackMessage;
6
use Anomaly\UsersModule\User\Contract\UserInterface;
7
use Anomaly\Streams\Platform\Notification\Message\MailMessage;
8
9
class UserPendingActivation extends Notification
10
{
11
    /**
12
     * The user pending activation.
13
     *
14
     * @var UserInterface
15
     */
16
    public $user;
17
18
    /**
19
     * Create a new UserPendingActivation instance.
20
     *
21
     * @param UserInterface $user
22
     */
23
    public function __construct(UserInterface $user)
24
    {
25
        $this->user = $user;
26
    }
27
28
    /**
29
     * Get the notification's delivery channels.
30
     *
31
     * @param  UserInterface $notifiable
32
     * @return array
33
     */
34
    public function via(UserInterface $notifiable)
35
    {
36
        return ['mail'];
37
    }
38
39
    /**
40
     * Return the mail message.
41
     *
42
     * @param  UserInterface $notifiable
43
     * @return MailMessage
44
     */
45 View Code Duplication
    public function toMail(UserInterface $notifiable)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
    {
47
        $data = $this->user->toArray();
48
49
        return (new MailMessage())
50
            ->view('anomaly.module.users::notifications.user_pending_activation')
51
            ->subject(trans('anomaly.module.users::notification.user_pending_activation.subject', $data))
52
            ->line(trans('anomaly.module.users::notification.user_pending_activation.instructions', $data))
53
            ->action(trans('anomaly.module.users::notification.user_pending_activation.button', $data), url('admin/users/edit/' . $this->user->getId()));
54
    }
55
}
56