SendRegistrationConfirmationEmail::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 17
rs 9.4286
c 1
b 0
f 0
cc 1
eloc 9
nc 1
nop 1
1
<?php namespace Modules\User\Events\Handlers;
2
3
use Illuminate\Mail\Message;
4
use Illuminate\Support\Facades\Mail;
5
use Modules\Core\Contracts\Authentication;
6
use Modules\User\Events\UserHasRegistered;
7
8
class SendRegistrationConfirmationEmail
9
{
10
    /**
11
     * @var AuthenticationRepository
12
     */
13
    private $auth;
14
15
    public function __construct(Authentication $auth)
16
    {
17
        $this->auth = $auth;
0 ignored issues
show
Documentation Bug introduced by
It seems like $auth of type object<Modules\Core\Contracts\Authentication> is incompatible with the declared type object<Modules\User\Even...thenticationRepository> of property $auth.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
18
    }
19
20
    public function handle(UserHasRegistered $event)
21
    {
22
        $user = $event->user;
23
24
        $activationCode = $this->auth->createActivation($user);
25
26
        $data = [
27
            'user' => $user,
28
            'activationcode' => $activationCode,
29
        ];
30
31
        Mail::queue('user::emails.welcome', $data,
32
            function (Message $m) use ($user) {
33
                $m->to($user->email)->subject('Welcome.');
34
            }
35
        );
36
    }
37
}
38