FormEvent   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 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
/*
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
     * Constructor.
38
     *
39
     * @param FormInterface $form
40
     * @param Request       $request
41
     * @param Response|null $response
42
     */
43
    public function __construct(FormInterface $form, Request $request, Response $response = null)
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...
44
    {
45
        $this->form = $form;
46
        $this->request = $request;
47
        $this->response = $response;
48
    }
49
50
    /**
51
     * @return FormInterface
52
     */
53
    public function getForm()
54
    {
55
        return $this->form;
56
    }
57
58
    /**
59
     * @return Request
60
     */
61
    public function getRequest()
62
    {
63
        return $this->request;
64
    }
65
66
    /**
67
     * @param Response $response
68
     */
69
    public function setResponse(Response $response)
70
    {
71
        $this->response = $response;
72
    }
73
74
    /**
75
     * @return Response|null
76
     */
77
    public function getResponse()
78
    {
79
        return $this->response;
80
    }
81
}
82