Date::setMin()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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