Completed
Push — master ( 59d827...fe270b )
by leo
05:52
created

CasUserLogoutEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 5
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: leo108
5
 * Date: 16/9/18
6
 * Time: 11:28
7
 */
8
9
namespace Leo108\CAS\Events;
10
11
use Illuminate\Http\Request;
12
use Illuminate\Queue\SerializesModels;
13
use Leo108\CAS\Contracts\Models\UserModel;
14
15 View Code Duplication
class CasUserLogoutEvent 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...
16
{
17
    use SerializesModels;
18
    /**
19
     * @var Request
20
     */
21
    protected $request;
22
    /**
23
     * @var UserModel
24
     */
25
    protected $user;
26
27
    /**
28
     * CasUserLoginEvent constructor.
29
     * @param Request   $request
30
     * @param UserModel $user
31
     */
32 1
    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...
33
    {
34 1
        $this->request = $request;
35 1
        $this->user    = $user;
36 1
    }
37
38
    /**
39
     * Get the channels the event should be broadcast on.
40
     *
41
     * @return array
42
     */
43
    public function broadcastOn()
44
    {
45
        return [];
46
    }
47
48
    /**
49
     * @return Request
50
     */
51
    public function getRequest()
52
    {
53
        return $this->request;
54
    }
55
56
    /**
57
     * @return UserModel
58
     */
59
    public function getUser()
60
    {
61
        return $this->user;
62
    }
63
}
64