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

InputDate::setValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 9
rs 9.9666
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
}