Help   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 6
dl 0
loc 39
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 4 1
A buildView() 0 4 1
A configureOptions() 0 6 1
A getExtendedType() 0 4 1
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
8
 */
9
namespace AnimeDb\Bundle\AppBundle\Form\Type;
10
11
use Symfony\Component\Form\AbstractTypeExtension;
12
use Symfony\Component\Form\FormInterface;
13
use Symfony\Component\Form\FormView;
14
use Symfony\Component\Form\FormBuilderInterface;
15
use Symfony\Component\OptionsResolver\OptionsResolver;
16
17
/**
18
 * Help type extension.
19
 */
20
class Help extends AbstractTypeExtension
21
{
22
    /**
23
     * @param FormBuilderInterface $builder
24
     * @param array $options
25
     */
26
    public function buildForm(FormBuilderInterface $builder, array $options)
27
    {
28
        $builder->setAttribute('help', $options['help']);
29
    }
30
31
    /**
32
     * @param FormView $view
33
     * @param FormInterface $form
34
     * @param array $options
35
     */
36
    public function buildView(FormView $view, FormInterface $form, array $options)
37
    {
38
        $view->vars['help'] = $form->getConfig()->getAttribute('help');
39
    }
40
41
    /**
42
     * @param OptionsResolver $resolver
43
     */
44
    public function configureOptions(OptionsResolver $resolver)
45
    {
46
        $resolver->setDefaults([
47
            'help' => null,
48
        ]);
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getExtendedType()
55
    {
56
        return 'form';
57
    }
58
}
59