|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace JDecool\Clockify\Model; |
|
6
|
|
|
|
|
7
|
|
|
class TimeEntryDtoImpl |
|
8
|
|
|
{ |
|
9
|
|
|
private $billable; |
|
10
|
|
|
private $description; |
|
11
|
|
|
private $id; |
|
12
|
|
|
private $isLocked; |
|
13
|
|
|
private $projectId; |
|
14
|
|
|
private $tagIds; |
|
15
|
|
|
private $taskId; |
|
16
|
|
|
private $timeInterval; |
|
17
|
|
|
private $userId; |
|
18
|
|
|
private $workspaceId; |
|
19
|
|
|
|
|
20
|
|
|
public static function fromArray(array $data): self |
|
21
|
|
|
{ |
|
22
|
|
|
return new self( |
|
23
|
|
|
$data['billable'], |
|
24
|
|
|
$data['description'], |
|
25
|
|
|
$data['id'], |
|
26
|
|
|
$data['isLocked'], |
|
27
|
|
|
$data['projectId'] ? $data['projectId'] : '', |
|
28
|
|
|
$data['tagIds'] ? $data['tagIds'] : [], |
|
29
|
|
|
$data['taskId'] ? $data['taskId'] : '', |
|
30
|
|
|
TimeIntervalDto::fromArray($data['timeInterval']), |
|
31
|
|
|
$data['userId'], |
|
32
|
|
|
$data['workspaceId'] |
|
33
|
|
|
); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @param string[] $tagIds |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct( |
|
40
|
|
|
bool $billable, |
|
41
|
|
|
string $description, |
|
42
|
|
|
string $id, |
|
43
|
|
|
bool $isLocked, |
|
44
|
|
|
string $projectId, |
|
45
|
|
|
array $tagIds, |
|
46
|
|
|
string $taskId, |
|
47
|
|
|
TimeIntervalDto $timeInterval, |
|
48
|
|
|
string $userId, |
|
49
|
|
|
string $workspaceId |
|
50
|
|
|
) { |
|
51
|
|
|
$this->billable = $billable; |
|
52
|
|
|
$this->description = $description; |
|
53
|
|
|
$this->id = $id; |
|
54
|
|
|
$this->isLocked = $isLocked; |
|
55
|
|
|
$this->projectId = $projectId; |
|
56
|
|
|
$this->tagIds = $tagIds; |
|
57
|
|
|
$this->taskId = $taskId; |
|
58
|
|
|
$this->timeInterval = $timeInterval; |
|
59
|
|
|
$this->userId = $userId; |
|
60
|
|
|
$this->workspaceId = $workspaceId; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function billable(): bool |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->billable; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function description(): string |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->description; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function id(): string |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->id; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function isLocked(): bool |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->isLocked; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function projectId(): string |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->projectId; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return string[] |
|
90
|
|
|
*/ |
|
91
|
|
|
public function tagIds() |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->tagIds; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function taskId(): string |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->taskId; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
public function timeInterval(): TimeIntervalDto |
|
102
|
|
|
{ |
|
103
|
|
|
return $this->timeInterval; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
public function userId(): string |
|
107
|
|
|
{ |
|
108
|
|
|
return $this->userId; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
public function workspaceId(): string |
|
112
|
|
|
{ |
|
113
|
|
|
return $this->workspaceId; |
|
114
|
|
|
} |
|
115
|
|
|
} |
|
116
|
|
|
|