Completed
Push — master ( aba493...5356ed )
by Ruud
315:38 queued 305:00
created

Kunstmaan/AdminListBundle/Event/AdminListEvent.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\AdminListBundle\Event;
4
5
use Symfony\Component\EventDispatcher\Event;
6
use Symfony\Component\Form\FormInterface;
7
use Symfony\Component\HttpFoundation\Request;
8
use Symfony\Component\HttpFoundation\Response;
9
10
class AdminListEvent extends Event
11
{
12
    /**
13
     * @var object
14
     */
15
    protected $entity;
16
17
    /**
18
     * @var FormInterface
19
     */
20
    protected $form;
21
22
    /**
23
     * @var Request
24
     */
25
    protected $request;
26
27
    /**
28
     * @var Response
29
     */
30
    protected $response;
31
32
    /**
33
     * AdminListEvent constructor.
34
     *
35
     * @param object             $entity
36
     * @param Request            $request
37
     * @param FormInterface|null $form
38
     */
39 1
    public function __construct($entity, Request $request, FormInterface $form = null)
0 ignored issues
show
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...
40
    {
41 1
        $this->entity = $entity;
42 1
        $this->request = $request;
43 1
        $this->form = $form;
44 1
    }
45
46
    /**
47
     * @return object
48
     */
49 1
    public function getEntity()
50
    {
51 1
        return $this->entity;
52
    }
53
54
    /**
55
     * @return Request
56
     */
57 1
    public function getRequest()
58
    {
59 1
        return $this->request;
60
    }
61
62
    /**
63
     * @return FormInterface|null
64
     */
65 1
    public function getForm()
66
    {
67 1
        return $this->form;
68
    }
69
70
    /**
71
     * @return Response
72
     */
73 1
    public function getResponse()
74
    {
75 1
        return $this->response;
76
    }
77
78
    /**
79
     * Sets a response and stops event propagation.
80
     *
81
     * @param Response $response
82
     */
83 1
    public function setResponse(Response $response)
84
    {
85 1
        $this->response = $response;
86
87 1
        $this->stopPropagation();
88 1
    }
89
}
90