Test Setup Failed
Branch master (730ea3)
by alexfloppy
03:21
created

SendVerifyEmailListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 5 1
1
<?php
2
3
namespace App\Listeners;
4
5
use App\Services\ActivationService;
6
use Illuminate\Auth\Events\Registered;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
9
/**
10
 * Class SendVerifyEmailListener
11
 * @package App\Listeners
12
 */
13
class SendVerifyEmailListener implements ShouldQueue
14
{
15
    private $activationService;
16
17
    /**
18
     * SendVerifyEmailListener constructor.
19
     * @param ActivationService $activationService
20
     */
21
    public function __construct(ActivationService $activationService)
22
    {
23
        $this->activationService = $activationService;
24
    }
25
26
    /**
27
     * Handle the event.
28
     *
29
     * @param  Registered  $event
30
     * @return void
31
     */
32
    public function handle(Registered $event)
33
    {
34
        $hash = $this->activationService->createActivation($event->user);
0 ignored issues
show
Compatibility introduced by
$event->user of type object<Illuminate\Contracts\Auth\Authenticatable> is not a sub-type of object<App\Models\User>. It seems like you assume a concrete implementation of the interface Illuminate\Contracts\Auth\Authenticatable to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
35
        $this->activationService->sendActivationEmail($event->user, $hash);
0 ignored issues
show
Compatibility introduced by
$event->user of type object<Illuminate\Contracts\Auth\Authenticatable> is not a sub-type of object<App\Models\User>. It seems like you assume a concrete implementation of the interface Illuminate\Contracts\Auth\Authenticatable to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
36
    }
37
}
38