AbstractIconExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 3
dl 0
loc 20
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildView() 0 4 1
A configureOptions() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Bundle\UiBundle\Form\Extension;
13
14
use Symfony\Component\Form\AbstractTypeExtension;
15
use Symfony\Component\Form\FormInterface;
16
use Symfony\Component\Form\FormView;
17
use Symfony\Component\OptionsResolver\OptionsResolver;
18
19
/**
20
 * @author GeLo <[email protected]>
21
 */
22
abstract class AbstractIconExtension extends AbstractTypeExtension
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 4
    public function buildView(FormView $view, FormInterface $form, array $options)
28
    {
29 4
        $view->vars['icon'] = $options['icon'];
30 4
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 4
    public function configureOptions(OptionsResolver $resolver)
36
    {
37
        $resolver
38 4
            ->setDefault('icon', null)
39 4
            ->setAllowedTypes('icon', ['string', 'null']);
40 4
    }
41
}
42