Completed
Push — feature/select_existing_custom... ( a1e51a )
by Laurent
01:57
created

InputDate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setValue() 0 9 2
1
<?php
2
3
namespace flightlog\form;
4
5
6
class InputDate extends BaseInput
7
{
8
    /**
9
     * @param string $name
10
     * @param array  $options
11
     */
12
    public function __construct($name, array $options = [])
13
    {
14
        parent::__construct($name, FormElementInterface::TYPE_DATE, $options);
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function setValue($value)
21
    {
22
        if($value instanceof \DateTime){
23
            return parent::setValue($value->format('Y-m-d'));
24
        }
25
26
        return parent::setValue($value);
27
28
    }
29
30
31
}