CRUDEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 38
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getRequest() 0 4 1
A getEntity() 0 4 1
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