TypeSetterExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildView() 0 4 2
A getExtendedType() 0 5 1
1
<?php
2
/**
3
 * This file is part of BraincraftedBootstrapBundle.
4
 * (c) 2012-2013 by Florian Eckerstorfer
5
 */
6
7
namespace Braincrafted\Bundle\BootstrapBundle\Form\Extension;
8
9
use Symfony\Component\Form\AbstractTypeExtension;
10
use Symfony\Component\Form\FormView;
11
use Symfony\Component\Form\FormInterface;
12
13
use Braincrafted\Bundle\BootstrapBundle\Util\LegacyFormHelper;
14
15
/**
16
 * TypeSetterExtension
17
 *
18
 * @package    BraincraftedBootstrapBundle
19
 * @subpackage Form
20
 * @author     Florian Eckerstorfer <[email protected]>
21
 * @copyright  2012-2013 Florian Eckerstorfer
22
 * @license    http://opensource.org/licenses/MIT The MIT License
23
 * @link       http://bootstrap.braincrafted.com Bootstrap for Symfony2
24
 */
25
class TypeSetterExtension extends AbstractTypeExtension
26
{
27
    /**
28
     * {@inheritDoc}
29
     */
30
    public function buildView(FormView $view, FormInterface $form, array $options)
31
    {
32
        $view->vars['original_type'] = LegacyFormHelper::isLegacy() ? $form->getConfig()->getType()->getName() : $form->getConfig()->getType()->getBlockPrefix();
0 ignored issues
show
Bug introduced by
The method getName() does not seem to exist on object<Symfony\Component...olvedFormTypeInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38
    public function getExtendedType()
39
    {
40
        // map old class to new one using LegacyFormHelper
41
        return LegacyFormHelper::getType('form');
42
    }
43
}
44