SendRegistrationConfirmationEmail   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 17 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