Completed
Push — master ( 2bde54...385f57 )
by wen
16:28
created

Date::getDefaultValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Sco\Admin\Form\Elements;
4
5
class Date extends Input
6
{
7
    protected $type = 'date';
8
9
    protected $format = 'yyyy-MM-dd';
10
11
    public function getFormat()
12
    {
13
        return $this->format;
14
    }
15
16
    public function setFormat($value)
17
    {
18
        $this->format = $value;
19
20
        return $this;
21
    }
22
23
    protected function getDefaultValue()
24
    {
25
        return date('Y-m-d');
26
    }
27
28
    public function toArray()
29
    {
30
        return parent::toArray() + [
31
                'format' => $this->getFormat(),
32
            ];
33
    }
34
}
35