Passed
Push — master ( 9b3fb0...881b80 )
by Jérémy
02:18
created

AutomaticLockDto::dayOfMonth()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JDecool\Clockify\Model;
6
7
class AutomaticLockDto
8
{
9
    private $changeDay;
10
    private $dayOfMonth;
11
    private $firstDay;
12
    private $olderThanPeriod;
13
    private $olderThanValue;
14
    private $type;
15
16
    public static function fromArray(array $data): self
17
    {
18
        return new self(
19
            new DaysEnum($data['changeDay']),
20
            $data['dayOfMonth'],
21
            new DaysEnum($data['firstDay']),
22
            new PeriodEnum($data['olderThanPeriod']),
23
            $data['olderThanValue'],
24
            new AutomaticLockEnum($data['type'])
25
        );
26
    }
27
28
    public function __construct(
29
        DaysEnum $changeDay,
30
        int $dayOfMonth,
31
        DaysEnum $firstDay,
32
        PeriodEnum $olderThanPeriod,
33
        int $olderThanValue,
34
        AutomaticLockEnum $type
35
    ) {
36
        $this->changeDay = $changeDay;
37
        $this->dayOfMonth = $dayOfMonth;
38
        $this->firstDay = $firstDay;
39
        $this->olderThanPeriod = $olderThanPeriod;
40
        $this->olderThanValue = $olderThanValue;
41
        $this->type = $type;
42
    }
43
44
    public function changeDay(): DaysEnum
45
    {
46
        return $this->changeDay;
47
    }
48
49
    public function dayOfMonth(): int
50
    {
51
        return $this->dayOfMonth;
52
    }
53
54
    public function firstDay(): DaysEnum
55
    {
56
        return $this->firstDay;
57
    }
58
59
    public function olderThanPeriod(): PeriodEnum
60
    {
61
        return $this->olderThanPeriod;
62
    }
63
64
    public function olderThanValue(): int
65
    {
66
        return $this->olderThanValue;
67
    }
68
69
    public function type(): AutomaticLockEnum
70
    {
71
        return $this->type;
72
    }
73
}
74