Completed
Push — master ( cefc4c...542ee6 )
by Daniel
06:07 queued 01:38
created

BirthdayField   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getViewType() 0 4 1
A getFormType() 0 4 1
A getStorageType() 0 4 1
A configureOptions() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\ContentType\Standard\Field;
6
7
use Psi\Component\ContentType\FieldInterface;
8
use Psi\Component\ContentType\OptionsResolver\FieldOptionsResolver;
9
use Psi\Component\ContentType\Standard\Storage as Storage;
10
use Psi\Component\ContentType\Standard\View as View;
11
use Symfony\Component\Form\Extension\Core\Type as Form;
12
13
class BirthdayField implements FieldInterface
14
{
15
    public function getViewType(): string
16
    {
17
        return View\DateTimeType::class;
18
    }
19
20
    public function getFormType(): string
21
    {
22
        return Form\BirthdayType::class;
23
    }
24
25
    public function getStorageType(): string
26
    {
27
        return Storage\DateTimeType::class;
28
    }
29
30
    public function configureOptions(FieldOptionsResolver $resolver)
31
    {
32
        $resolver->setViewMapper(function ($options) {
33
            return array_merge([
34
                'time_format' => 'none',
35
            ], $options);
36
        });
37
    }
38
}
39