Completed
Push — master ( ee87ec...477f2c )
by Grégoire
13s queued 10s
created

FormEvent::getForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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