Completed
Push — master ( e79dfa...ffecda )
by Benjamin
02:16
created

UserEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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