CasUserLoginEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 5
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Leo108\CAS\Events;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Queue\SerializesModels;
7
use Leo108\CAS\Contracts\Models\UserModel;
8
9 View Code Duplication
class CasUserLoginEvent extends Event
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    use SerializesModels;
12
13
    /**
14
     * @var Request
15
     */
16
    protected $request;
17
    /**
18
     * @var UserModel
19
     */
20
    protected $user;
21
22
    /**
23
     * CasUserLoginEvent constructor.
24
     * @param Request   $request
25
     * @param UserModel $user
26
     */
27 2
    public function __construct(Request $request, UserModel $user)
0 ignored issues
show
Bug introduced by
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
28
    {
29 2
        $this->request = $request;
30 2
        $this->user    = $user;
31 2
    }
32
33
    /**
34
     * Get the channels the event should be broadcast on.
35
     *
36
     * @return array
37
     */
38
    public function broadcastOn()
39
    {
40
        return [];
41
    }
42
43
    /**
44
     * @return Request
45
     */
46
    public function getRequest()
47
    {
48
        return $this->request;
49
    }
50
51
    /**
52
     * @return UserModel
53
     */
54
    public function getUser()
55
    {
56
        return $this->user;
57
    }
58
}
59