Completed
Push — feature/multi_order ( eb7707 )
by Laurent
01:37
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
 * This file is part of the Adlogix package.
4
 *
5
 * (c) Allan Segebarth <[email protected]>
6
 * (c) Jean-Jacques Courtens <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace flightlog\form;
13
14
15
class InputDate extends BaseInput
16
{
17
    /**
18
     * @param string $name
19
     * @param array  $options
20
     */
21
    public function __construct($name, array $options = [])
22
    {
23
        parent::__construct($name, FormElementInterface::TYPE_DATE, $options);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function setValue($value)
30
    {
31
        if($value instanceof \DateTime){
32
            return parent::setValue($value->format('Y-m-d'));
33
        }
34
35
        return parent::setValue($value);
36
37
    }
38
39
40
}