Code Duplication    Length = 11-11 lines in 3 locations

src/Jarboe/Table/Fields/Date.php 1 location

@@ 20-30 (lines=11) @@
17
    protected $format = 'YYYY-MM-DD';
18
    protected $months = 1;
19
20
    public function default($value)
21
    {
22
        if (is_object($value) && is_a($value, \DateTime::class)) {
23
            /** @var \DateTime $value */
24
            $this->default = $value->format('Y-m-d');
25
        } else {
26
            $this->default = date('Y-m-d', strtotime($value));
27
        }
28
29
        return $this;
30
    }
31
32
    public function format(string $momentJsFormat)
33
    {

src/Jarboe/Table/Fields/Datetime.php 1 location

@@ 29-39 (lines=11) @@
26
        return $this->format;
27
    }
28
29
    public function default($value)
30
    {
31
        if (is_object($value) && is_a($value, \DateTime::class)) {
32
            /** @var \DateTime $value */
33
            $this->default = $value->format('Y-m-d H:i:s');
34
        } else {
35
            $this->default = date('Y-m-d H:i:s', strtotime($value));
36
        }
37
38
        return $this;
39
    }
40
41
    public function getListView($model)
42
    {

src/Jarboe/Table/Fields/Time.php 1 location

@@ 44-54 (lines=11) @@
41
        return $this->placement;
42
    }
43
44
    public function default($value)
45
    {
46
        if (is_object($value) && is_a($value, \DateTime::class)) {
47
            /** @var \DateTime $value */
48
            $this->default = $value->format('H:i:s');
49
        } else {
50
            $this->default = date('H:i:s', strtotime($value));
51
        }
52
53
        return $this;
54
    }
55
56
    public function getListView($model)
57
    {