| Total Complexity | 8 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 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 |
||
| 57 | } |
||
| 58 | |||
| 59 | public function olderThanPeriod(): PeriodEnum |
||
| 62 | } |
||
| 63 | |||
| 64 | public function olderThanValue(): int |
||
| 65 | { |
||
| 66 | return $this->olderThanValue; |
||
| 67 | } |
||
| 68 | |||
| 69 | public function type(): AutomaticLockEnum |
||
| 72 | } |
||
| 73 | } |
||
| 74 |