1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Soheilrt\AdobeConnectClient\Client\Entities; |
4
|
|
|
|
5
|
|
|
use DateInterval; |
6
|
|
|
use DateTimeImmutable; |
7
|
|
|
use Exception; |
8
|
|
|
use InvalidArgumentException; |
9
|
|
|
use Soheilrt\AdobeConnectClient\Client\Helpers\ValueTransform as VT; |
10
|
|
|
use Soheilrt\AdobeConnectClient\Client\Traits\Fillable; |
11
|
|
|
use Soheilrt\AdobeConnectClient\Client\Traits\PropertyCaller; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* The recording archive from a SCO. |
15
|
|
|
* |
16
|
|
|
* @property int|string|mixed $sco_id |
17
|
|
|
* @property int|string|mixed $source_sco_id |
18
|
|
|
* @property int|string|mixed $folder_id |
19
|
|
|
* @property int|string|mixed $display_seq |
20
|
|
|
* @property int|string|mixed $job_id |
21
|
|
|
* @property int|string|mixed $account_id |
22
|
|
|
* @property int|string|mixed $encoder_service_job_progress |
23
|
|
|
* @property int|string|mixed $no_of_downloads |
24
|
|
|
* @property int|string|mixed $file_name |
25
|
|
|
* @property string|mixed $type |
26
|
|
|
* @property string|mixed $icon |
27
|
|
|
* @property string|mixed $job_status |
28
|
|
|
* @property string|mixed $name |
29
|
|
|
* @property string|mixed $url_path |
30
|
|
|
* @property bool|string|mixed $is_folder |
31
|
|
|
* @property DateTimeImmutable|mixed $date_begin |
32
|
|
|
* @property DateTimeImmutable|mixed $date_end |
33
|
|
|
* @property DateTimeImmutable|mixed $date_created |
34
|
|
|
* @property DateTimeImmutable|mixed $date_modified |
35
|
|
|
* @property DateInterval|mixed $duration |
36
|
|
|
* |
37
|
|
|
* @method int|string|mixed getScoId() |
38
|
|
|
* @method int|string|mixed getSourceScoId() |
39
|
|
|
* @method int|string|mixed getFolderId() |
40
|
|
|
* @method int|string|mixed getDisplaySeq() |
41
|
|
|
* @method int|string|mixed getJobId() |
42
|
|
|
* @method int|string|mixed getAccountId() |
43
|
|
|
* @method int|string|mixed getEncoderServiceJobProgress() |
44
|
|
|
* @method int|string|mixed getNoOfDownloads() |
45
|
|
|
* @method int|string|mixed getFileName() |
46
|
|
|
* @method string|mixed getType() |
47
|
|
|
* @method string|mixed getIcon() |
48
|
|
|
* @method string|mixed getJobStatus() |
49
|
|
|
* @method string|mixed getName() |
50
|
|
|
* @method string|mixed getUrlPath() |
51
|
|
|
* @method bool|string|mixed getIsFolder() |
52
|
|
|
* @method DateTimeImmutable|mixed getDateBegin() |
53
|
|
|
* @method DateTimeImmutable|mixed getDateEnd() |
54
|
|
|
* @method DateTimeImmutable|mixed getDateCreated() |
55
|
|
|
* @method DateTimeImmutable|mixed getDateModified() |
56
|
|
|
* @method DateInterval|mixed getDuration() |
57
|
|
|
* |
58
|
|
|
* @method int|string|mixed setScoId($value) |
59
|
|
|
* @method int|string|mixed setSourceScoId($value) |
60
|
|
|
* @method int|string|mixed setFolderId($value) |
61
|
|
|
* @method int|string|mixed setDisplaySeq($value) |
62
|
|
|
* @method int|string|mixed setJobId($value) |
63
|
|
|
* @method int|string|mixed setAccountId($value) |
64
|
|
|
* @method int|string|mixed setEncoderServiceJobProgress($value) |
65
|
|
|
* @method int|string|mixed setNoOfDownloads($value) |
66
|
|
|
* @method int|string|mixed setFileName($value) |
67
|
|
|
* @method string|mixed setType($value) |
68
|
|
|
* @method string|mixed setIcon($value) |
69
|
|
|
* @method string|mixed setJobStatus($value) |
70
|
|
|
* @method string|mixed setName($value) |
71
|
|
|
* @method string|mixed setUrlPath($value) |
72
|
|
|
*/ |
73
|
|
|
class SCORecord |
74
|
|
|
{ |
75
|
|
|
use PropertyCaller,Fillable; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Set if is Folder. |
79
|
|
|
* |
80
|
|
|
* @param bool $isFolder |
81
|
|
|
* |
82
|
|
|
* @return void |
83
|
|
|
*/ |
84
|
|
|
public function setIsFolder($isFolder): void |
85
|
|
|
{ |
86
|
|
|
$this->attributes['isFolder'] = VT::toBool($isFolder); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Set the Begin date. |
91
|
|
|
* |
92
|
|
|
* @param string|DateTimeImmutable $dateBegin |
93
|
|
|
* |
94
|
|
|
* @throws Exception |
95
|
|
|
*/ |
96
|
|
|
public function setDateBegin($dateBegin): void |
97
|
|
|
{ |
98
|
|
|
$this->attributes['dateBegin'] = VT::toDateTimeImmutable($dateBegin); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Set the End date. |
103
|
|
|
* |
104
|
|
|
* @param string|DateTimeImmutable $dateEnd |
105
|
|
|
* |
106
|
|
|
* @throws Exception |
107
|
|
|
*/ |
108
|
|
|
public function setDateEnd($dateEnd): void |
109
|
|
|
{ |
110
|
|
|
$this->attributes['dateEnd'] = VT::toDateTimeImmutable($dateEnd); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Set the Created date. |
115
|
|
|
* |
116
|
|
|
* @param string|DateTimeImmutable $dateCreated |
117
|
|
|
* |
118
|
|
|
* @throws Exception |
119
|
|
|
*/ |
120
|
|
|
public function setDateCreated($dateCreated): void |
121
|
|
|
{ |
122
|
|
|
$this->attributes['dateCreated'] = VT::toDateTimeImmutable($dateCreated); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Set the Modified date. |
127
|
|
|
* |
128
|
|
|
* @param string|DateTimeImmutable $dateModified |
129
|
|
|
* |
130
|
|
|
* @throws Exception |
131
|
|
|
*/ |
132
|
|
|
public function setDateModified($dateModified): void |
133
|
|
|
{ |
134
|
|
|
$this->attributes['dateModified'] = VT::toDateTimeImmutable($dateModified); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Set the Duration. |
139
|
|
|
* |
140
|
|
|
* @param DateInterval|string $duration String in format hh:mm:ss |
141
|
|
|
* |
142
|
|
|
* @throws InvalidArgumentException |
143
|
|
|
*/ |
144
|
|
|
public function setDuration($duration): void |
145
|
|
|
{ |
146
|
|
|
if (is_string($duration)) { |
147
|
|
|
$duration = $this->timeStringToDateInterval($duration); |
148
|
|
|
} |
149
|
|
|
$this->attributes['duration'] = $duration; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Converts the time duration string into a \DateInterval. |
154
|
|
|
* |
155
|
|
|
* @param string $timeString A string like hh:mm:ss |
156
|
|
|
* |
157
|
|
|
* @throws InvalidArgumentException |
158
|
|
|
* |
159
|
|
|
* @return DateInterval |
160
|
|
|
*/ |
161
|
|
|
protected function timeStringToDateInterval($timeString): ?DateInterval |
162
|
|
|
{ |
163
|
|
|
try { |
164
|
|
|
return new DateInterval( |
165
|
|
|
preg_replace( |
166
|
|
|
'/(\d{2}):(\d{2}):(\d{2}).*/', |
167
|
|
|
'PT$1H$2M$3S', |
168
|
|
|
$timeString |
169
|
|
|
) |
170
|
|
|
); |
171
|
|
|
} catch (Exception $e) { |
172
|
|
|
throw new InvalidArgumentException('Timestring is not a valid interval'); |
173
|
|
|
} |
174
|
|
|
} |
175
|
|
|
} |
176
|
|
|
|