CRUDEvent::getEntity()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Ob\CmsBundle\Event;
4
5
use Symfony\Component\EventDispatcher\Event;
6
use Symfony\Component\HttpFoundation\Request;
7
8
class CRUDEvent extends Event
9
{
10
    /**
11
     * @var Request
12
     */
13
    private $request;
14
15
    /**
16
     * @var mixed
17
     */
18
    private $entity;
19
20
    /**
21
     * @param Request $request
22
     * @param mixed   $entity
23
     */
24
    public function __construct(Request $request, $entity)
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...
25
    {
26
        $this->request = $request;
27
        $this->entity  = $entity;
28
    }
29
30
    /**
31
     * @return Request
32
     */
33
    public function getRequest()
34
    {
35
        return $this->request;
36
    }
37
38
    /**
39
     * @return mixed
40
     */
41
    public function getEntity()
42
    {
43
        return $this->entity;
44
    }
45
}
46