Date   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 8
c 0
b 0
f 0
dl 0
loc 17
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setMin() 0 4 1
A setMax() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Enjoys\Forms\Elements;
6
7
use Enjoys\Forms\AttributeFactory;
8
use Enjoys\Forms\Element;
9
use Enjoys\Forms\Interfaces\Descriptionable;
10
use Enjoys\Forms\Interfaces\Ruleable;
11
use Enjoys\Forms\Traits\Description;
12
use Enjoys\Forms\Traits\Rules;
13
14
class Date extends Element implements Ruleable, Descriptionable
15
{
16
    use Description;
17
    use Rules;
18
19
    protected string $type = 'date';
20
21 1
    public function setMin(\DateTimeInterface $date): self
22
    {
23 1
        $this->setAttribute(AttributeFactory::create('min', $date->format('Y-m-d')));
24 1
        return $this;
25
    }
26
27 1
    public function setMax(\DateTimeInterface $date): self
28
    {
29 1
        $this->setAttribute(AttributeFactory::create('max', $date->format('Y-m-d')));
30 1
        return $this;
31
    }
32
}
33