DatePickerType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 13 1
A getBlockPrefix() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the CMS Kernel package.
5
 *
6
 * Copyright (c) 2016-present LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LIN3S\CMSKernel\Infrastructure\Symfony\Form\Type;
13
14
use Symfony\Component\Form\AbstractType;
15
use Symfony\Component\Form\CallbackTransformer;
16
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
17
use Symfony\Component\Form\FormBuilderInterface;
18
19
/**
20
 * @author Mikel Tuesta <[email protected]>
21
 */
22
class DatePickerType extends AbstractType
23
{
24
25
    public function buildForm(FormBuilderInterface $builder, array $options)
26
    {
27
        $builder
28
            ->add('date_picker', HiddenType::class)
29
            ->addModelTransformer(new CallbackTransformer(
30
                function ($value) {
31
                    return ['date_picker' => $value];
32
                },
33
                function ($value) {
34
                    return $value['date_picker'];
35
                }
36
            ));
37
    }
38
39
    public function getBlockPrefix()
40
    {
41
        return 'lin3s_cms_date_picker';
42
    }
43
}
44