FeatureTypeType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 20 2
A getName() 0 4 1
1
<?php
2
/*************************************************************************************/
3
/*      This file is part of the module FeatureType                                  */
4
/*                                                                                   */
5
/*      For the full copyright and license information, please view the LICENSE.txt  */
6
/*      file that was distributed with this source code.                             */
7
/*************************************************************************************/
8
9
namespace FeatureType\Form\Type;
10
11
use FeatureType\FeatureType;
12
use Symfony\Component\Form\AbstractType;
13
use Symfony\Component\Form\FormBuilderInterface;
14
use Thelia\Core\Translation\Translator;
15
16
/**
17
 * Class FeatureTypeType
18
 * @package FeatureType\Form\Type
19
 * @author Gilles Bourgeat <[email protected]>
20
 */
21
class FeatureTypeType extends AbstractType
22
{
23
    public function buildForm(FormBuilderInterface $builder, array $options)
24
    {
25
        $formOptions = ['required' => true];
26
27
        // Fix for symfony/form 2.8.49
28
        if (isset($options['allow_file_upload'])) {
29
            $formOptions['allow_file_upload'] = true;
30
        }
31
        
32
        $builder->add(
33
            'feature_type',
34
            'collection',
35
            array(
36
                'type' => 'text',
37
                'allow_add'    => true,
38
                'allow_delete' => true,
39
                'options' => $formOptions
40
            )
41
        );
42
    }
43
44
    public function getName()
45
    {
46
        return 'feature_type';
47
    }
48
}
49