Completed
Push — master ( 96ea8b...1276b9 )
by Alexis
08:08
created

FormEvent::setResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the awurth/silex-user package.
5
 *
6
 * (c) Alexis Wurth <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace AWurth\Silex\User\Event;
13
14
use Symfony\Component\EventDispatcher\Event;
15
use Symfony\Component\Form\FormInterface;
16
use Symfony\Component\HttpFoundation\Request;
17
use Symfony\Component\HttpFoundation\Response;
18
19
class FormEvent extends Event
20
{
21
    /**
22
     * @var FormInterface
23
     */
24
    private $form;
25
26
    /**
27
     * @var Request
28
     */
29
    private $request;
30
31
    /**
32
     * @var Response
33
     */
34
    private $response;
35
36
    /**
37
     * FormEvent constructor.
38
     *
39
     * @param FormInterface $form
40
     * @param Request       $request
41
     */
42
    public function __construct(FormInterface $form, 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...
43
    {
44
        $this->form = $form;
45
        $this->request = $request;
46
    }
47
48
    /**
49
     * @return FormInterface
50
     */
51
    public function getForm()
52
    {
53
        return $this->form;
54
    }
55
56
    /**
57
     * @return Request
58
     */
59
    public function getRequest()
60
    {
61
        return $this->request;
62
    }
63
64
    /**
65
     * @param Response $response
66
     */
67
    public function setResponse(Response $response)
68
    {
69
        $this->response = $response;
70
    }
71
72
    /**
73
     * @return Response|null
74
     */
75
    public function getResponse()
76
    {
77
        return $this->response;
78
    }
79
}
80