Completed
Push — master ( c0eb3b...a45428 )
by Rasmus
12:07
created

DateTimeLocalField   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
1
<?php
2
3
namespace mindplay\kissform\Fields;
4
5
use mindplay\kissform\InputModel;
6
7
/**
8
 * Date/time field-type for string-based input using HTML5 `<input type="datetime-local">`.
9
 *
10
 * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
11
 */
12
class DateTimeLocalField extends DateTimeField
13
{
14
    const HTML5_FORMAT = "Y-m-d\\TH:i";
15
16
    /**
17
     * @param string $name     field name
18
     * @param string $timezone timezone name
19
     * @param array  $attrs    map of HTML attribtues to apply
20
     */
21 1
    public function __construct($name, $timezone, $attrs = [])
22
    {
23
        $attrs += [
24 1
            "type" => "datetime-local",
25
        ];
26
27 1
        parent::__construct($name, $timezone, self::HTML5_FORMAT, $attrs);
28 1
    }
29
}
30