FormStaticControlType   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A configureOptions() 0 8 1
A getParent() 0 5 1
A getName() 0 3 1
A getBlockPrefix() 0 4 1
1
<?php
2
/**
3
 * This file is part of BraincraftedBootstrapBundle.
4
 */
5
6
namespace Braincrafted\Bundle\BootstrapBundle\Form\Type;
7
8
use Symfony\Component\Form\AbstractType;
9
use Symfony\Component\OptionsResolver\OptionsResolver;
10
use Symfony\Component\Form\Extension\Core\Type\TextType;
11
use Braincrafted\Bundle\BootstrapBundle\Util\LegacyFormHelper;
12
13
/**
14
 * FormStaticControlType
15
 *
16
 * @package    BraincraftedBootstrapBundle
17
 * @subpackage Form
18
 * @author     André Püschel <[email protected]>
19
 * @copyright  2014 André Püschel
20
 * @license    http://opensource.org/licenses/MIT The MIT License
21
 * @link       http://bootstrap.braincrafted.com Bootstrap for Symfony2
22
 */
23
class FormStaticControlType extends AbstractType
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function configureOptions(OptionsResolver $resolver)
29
    {
30
        $resolver->setDefaults(array(
31
            //'mapped'         => false,
32
            'required'       => false,
33
            'disabled'      => true,
34
        ));
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getParent()
41
    {
42
        // map old class to new one using LegacyFormHelper
43
        return LegacyFormHelper::getType('text');
44
    }
45
46
    /**
47
     * Backward compatibility for SF < 3.0
48
     *
49
     * @return null|string
50
     */
51
    public function getName() {
52
        return $this->getBlockPrefix();
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function getBlockPrefix()
59
    {
60
        return 'bs_static';
61
    }
62
}
63