FormViewEvent::getForm()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
rs 10
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Pgs\RestfonyBundle\Event;
4
5
use Symfony\Component\EventDispatcher\Event;
6
use Symfony\Component\Form\FormInterface;
7
use Symfony\Component\HttpFoundation\Request;
8
9
/**
10
 * @author Michał Sikora
11
 */
12 View Code Duplication
class FormViewEvent extends Event
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * @var FormInterface
16
     */
17
    private $form;
18
19
    /**
20
     * @var Request
21
     */
22
    private $request;
23
24
    /**
25
     * @param FormInterface $form
26
     * @param Request       $request
27
     */
28 4
    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...
29
    {
30 4
        $this->form = $form;
31 4
        $this->request = $request;
32 4
    }
33
34
    /**
35
     * @return FormInterface
36
     */
37 1
    public function getForm()
38
    {
39 1
        return $this->form;
40
    }
41
42
    /**
43
     * @return Request
44
     */
45 1
    public function getRequest()
46
    {
47 1
        return $this->request;
48
    }
49
}
50