UserLogedNotification::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
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\Events\LogedUser;
6
use App\Mail\HelloUser;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
use Illuminate\Support\Facades\Log;
9
use Illuminate\Support\Facades\Mail;
10
11
class UserLogedNotification implements ShouldQueue
12
{
13
    /**
14
     * Create the event listener.
15
     *
16
     * @return void
17
     */
18
    public function __construct()
19
    {
20
        //
21
    }
22
23
    /**
24
     * Handle the event.
25
     *
26
     * @param object $event
27
     *
28
     * @return void
29
     */
30
    public function handle(LogedUser $event)
31
    {
32
33
        $hello = new HelloUser($event->user);
0 ignored issues
show
Unused Code introduced by
The call to App\Mail\HelloUser::__construct() has too many arguments starting with $event->user. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        $hello = /** @scrutinizer ignore-call */ new HelloUser($event->user);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
34
        Mail::to($event->user)->send($hello);
35
36
        Log::info("Email has been send");
37
    }
38
}
39