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

InputDate::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
}