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

SendVerifyEmailListener::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 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