UserPendingActivation::toMail()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 10
Ratio 76.92 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 10
loc 13
c 1
b 0
f 0
rs 9.4285
cc 1
eloc 9
nc 1
nop 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\Contracts\Queue\ShouldQueue;
7
use Illuminate\Notifications\Notification;
8
9
/**
10
 * Class UserPendingActivation
11
 *
12
 * @link   http://pyrocms.com/
13
 * @author PyroCMS, Inc. <[email protected]>
14
 * @author Ryan Thompson <[email protected]>
15
 */
16
class UserPendingActivation extends Notification implements ShouldQueue
17
{
18
19
    use Queueable;
20
21
    /**
22
     * The user pending activation.
23
     *
24
     * @var UserInterface
25
     */
26
    public $user;
27
28
    /**
29
     * Create a new UserPendingActivation instance.
30
     *
31
     * @param UserInterface $user
32
     */
33
    public function __construct(UserInterface $user)
34
    {
35
        $this->user = $user;
36
    }
37
38
    /**
39
     * Get the notification's delivery channels.
40
     *
41
     * @param  UserInterface $notifiable
42
     * @return array
43
     */
44
    public function via(UserInterface $notifiable)
45
    {
46
        return ['mail'];
47
    }
48
49
    /**
50
     * Return the mail message.
51
     *
52
     * @param  UserInterface $notifiable
53
     * @return MailMessage
54
     */
55 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...
56
    {
57
        $data = $this->user->toArray();
58
59
        return (new MailMessage())
60
            ->view('anomaly.module.users::notifications.user_pending_activation')
61
            ->subject(trans('anomaly.module.users::notification.user_pending_activation.subject', $data))
62
            ->line(trans('anomaly.module.users::notification.user_pending_activation.instructions', $data))
63
            ->action(
64
                trans('anomaly.module.users::notification.user_pending_activation.button', $data),
65
                url('admin/users/edit/' . $this->user->getId())
66
            );
67
    }
68
}
69