UserEvent::getUser()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Alpixel\Bundle\UserBundle\Event;
4
5
use Alpixel\Bundle\UserBundle\Entity\User;
6
use Symfony\Component\EventDispatcher\Event;
7
use Symfony\Component\HttpFoundation\Request;
8
9
class UserEvent extends Event
10
{
11
    protected $user;
12
    protected $request;
13
14
    public function __construct(User $user, Request $request)
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...
15
    {
16
        $this->user = $user;
17
        $this->request = $request;
18
    }
19
20
    public function getUser()
21
    {
22
        return $this->user;
23
    }
24
25
    public function getRequest()
26
    {
27
        return $this->request;
28
    }
29
}
30