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

FormEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 43
rs 10
c 0
b 0
f 0

5 Methods

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