Completed
Pull Request — master (#244)
by Łukasz
11:47
created

FormWorker   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A mount() 0 6 3
1
<?php
2
3
namespace FSi\Bundle\AdminBundle\Factory\Worker;
4
5
use FSi\Bundle\AdminBundle\Admin\CRUD\FormAwareInterface;
6
use FSi\Bundle\AdminBundle\Admin\CRUD\FormElement;
7
use FSi\Bundle\AdminBundle\Admin\Element;
8
use FSi\Bundle\AdminBundle\Factory\Worker;
9
use Symfony\Component\Form\FormFactoryInterface;
10
11
class FormWorker implements Worker
12
{
13
    /**
14
     * @var FormFactoryInterface
15
     */
16
    private $formFactory;
17
18
    /**
19
     * @param FormFactoryInterface $formFactory
20
     */
21
    function __construct(FormFactoryInterface $formFactory)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
22
    {
23
        $this->formFactory = $formFactory;
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function mount(Element $element)
30
    {
31
        if ($element instanceof FormAwareInterface || $element instanceof FormElement) {
32
            $element->setFormFactory($this->formFactory);
33
        }
34
    }
35
}
36