AbstractIconExtension::buildView()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 3
crap 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