1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace JDecool\Clockify\Model; |
6
|
|
|
|
7
|
|
|
class UserSettingsDto |
8
|
|
|
{ |
9
|
|
|
private $collapseAllProjectLists; |
10
|
|
|
private $dashboardPinToTop; |
11
|
|
|
private $dashboardSelection; |
12
|
|
|
private $dashboardViewType; |
13
|
|
|
private $dateFormat; |
14
|
|
|
private $isCompactViewOn; |
15
|
|
|
private $longRunning; |
16
|
|
|
private $projectListCollapse; |
17
|
|
|
private $sendNewsletter; |
18
|
|
|
private $summaryReportSettings; |
19
|
|
|
private $timeFormat; |
20
|
|
|
private $timeTrackingManual; |
21
|
|
|
private $timeZone; |
22
|
|
|
private $weekStart; |
23
|
|
|
private $weeklyUpdates; |
24
|
|
|
|
25
|
|
|
public static function fromArray(array $data): self |
26
|
|
|
{ |
27
|
|
|
return new self( |
28
|
|
|
$data['collapseAllProjectLists'], |
29
|
|
|
$data['dashboardPinToTop'], |
30
|
|
|
new DashboardSelection($data['dashboardSelection']), |
31
|
|
|
new DashboardViewType($data['dashboardViewType']), |
32
|
|
|
$data['dateFormat'], |
33
|
|
|
$data['isCompactViewOn'], |
34
|
|
|
$data['longRunning'], |
35
|
|
|
$data['projectListCollapse'], |
36
|
|
|
$data['sendNewsletter'], |
37
|
|
|
SummaryReportSettingsDto::fromArray($data['summaryReportSettings']), |
38
|
|
|
$data['timeFormat'], |
39
|
|
|
$data['timeTrackingManual'], |
40
|
|
|
$data['timeZone'], |
41
|
|
|
new DaysEnum($data['weekStart']), |
42
|
|
|
$data['weeklyUpdates'] |
43
|
|
|
); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function __construct( |
47
|
|
|
bool $collapseAllProjectLists, |
48
|
|
|
bool $dashboardPinToTop, |
49
|
|
|
DashboardSelection $dashboardSelection, |
50
|
|
|
DashboardViewType $dashboardViewType, |
51
|
|
|
string $dateFormat, |
52
|
|
|
bool $isCompactViewOn, |
53
|
|
|
bool $longRunning, |
54
|
|
|
int $projectListCollapse, |
55
|
|
|
bool $sendNewsletter, |
56
|
|
|
SummaryReportSettingsDto $summaryReportSettings, |
57
|
|
|
string $timeFormat, |
58
|
|
|
bool $timeTrackingManual, |
59
|
|
|
string $timeZone, |
60
|
|
|
DaysEnum $weekStart, |
61
|
|
|
bool $weeklyUpdates |
62
|
|
|
) { |
63
|
|
|
$this->collapseAllProjectLists = $collapseAllProjectLists; |
64
|
|
|
$this->dashboardPinToTop = $dashboardPinToTop; |
65
|
|
|
$this->dashboardSelection = $dashboardSelection; |
66
|
|
|
$this->dashboardViewType = $dashboardViewType; |
67
|
|
|
$this->dateFormat = $dateFormat; |
68
|
|
|
$this->isCompactViewOn = $isCompactViewOn; |
69
|
|
|
$this->longRunning = $longRunning; |
70
|
|
|
$this->projectListCollapse = $projectListCollapse; |
71
|
|
|
$this->sendNewsletter = $sendNewsletter; |
72
|
|
|
$this->summaryReportSettings = $summaryReportSettings; |
73
|
|
|
$this->timeFormat = $timeFormat; |
74
|
|
|
$this->timeTrackingManual = $timeTrackingManual; |
75
|
|
|
$this->timeZone = $timeZone; |
76
|
|
|
$this->weekStart = $weekStart; |
77
|
|
|
$this->weeklyUpdates = $weeklyUpdates; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function collapseAllProjectLists(): bool |
81
|
|
|
{ |
82
|
|
|
return $this->collapseAllProjectLists; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function dashboardPinToTop(): bool |
86
|
|
|
{ |
87
|
|
|
return $this->dashboardPinToTop; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function dashboardSelection(): DashboardSelection |
91
|
|
|
{ |
92
|
|
|
return $this->dashboardSelection; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function dashboardViewType(): DashboardViewType |
96
|
|
|
{ |
97
|
|
|
return $this->dashboardViewType; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function dateFormat(): string |
101
|
|
|
{ |
102
|
|
|
return $this->dateFormat; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function isCompactViewOn(): bool |
106
|
|
|
{ |
107
|
|
|
return $this->isCompactViewOn; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function longRunning(): bool |
111
|
|
|
{ |
112
|
|
|
return $this->longRunning; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function projectListCollapse(): int |
116
|
|
|
{ |
117
|
|
|
return $this->projectListCollapse; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
public function sendNewsletter(): bool |
121
|
|
|
{ |
122
|
|
|
return $this->sendNewsletter; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function summaryReportSettings(): SummaryReportSettingsDto |
126
|
|
|
{ |
127
|
|
|
return $this->summaryReportSettings; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function timeFormat(): string |
131
|
|
|
{ |
132
|
|
|
return $this->timeFormat; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function timeTrackingManual(): bool |
136
|
|
|
{ |
137
|
|
|
return $this->timeTrackingManual; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public function timeZone(): string |
141
|
|
|
{ |
142
|
|
|
return $this->timeZone; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public function weekStart(): DaysEnum |
146
|
|
|
{ |
147
|
|
|
return $this->weekStart; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function weeklyUpdates(): bool |
151
|
|
|
{ |
152
|
|
|
return $this->weeklyUpdates; |
153
|
|
|
} |
154
|
|
|
} |
155
|
|
|
|