DateTimeField   A
last analyzed

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;
10
use Psi\Component\ContentType\Standard\View;
11
use Symfony\Component\Form\Extension\Core\Type as Form;
12
13
class DateTimeField 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\DateTimeType::class;
23
    }
24
25
    public function getStorageType(): string
26
    {
27
        return Storage\DateTimeType::class;
28
    }
29
30
    public function configureOptions(FieldOptionsResolver $options)
31
    {
32
        $options->setFormMapper(function ($options, $shared) {
0 ignored issues
show
Unused Code introduced by
The parameter $shared is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
33
            $options['input'] = 'datetime';
34
35
            return $options;
36
        });
37
    }
38
}
39