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

ServicesTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createNamedBuilder() 0 8 1
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