Completed
Push — feature/multi_order ( eb7707 )
by Laurent
01:37
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
 * 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
}