Completed
Push — master ( f1dd26...2cc827 )
by Dmitri
03:03
created

ServicesTrait::createNamedBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace AppBundle\Controller;
4
5
use Symfony\Component\Form\Extension\Core\Type\FormType;
6
7
trait ServicesTrait
8
{
9
    /**
10
     * @param string $name
11
     * @param mixed  $data
12
     * @param array  $options
13
     *
14
     * @return \Symfony\Component\Form\FormBuilderInterface
15
     */
16
    public function createNamedBuilder($name, $data = null, array $options = [])
17
    {
18
        /** @var \Symfony\Component\Form\FormFactoryInterface $factory */
19
        $factory = $this->container->get('form.factory');
0 ignored issues
show
Bug Best Practice introduced by
The property container does not exist on AppBundle\Controller\ServicesTrait. Did you maybe forget to declare it?
Loading history...
20
21
        $defaults = ['action' => '#'];
22
23
        return $factory->createNamedBuilder($name, FormType::class, $data, array_merge($defaults, $options));
24
    }
25
}
26