|
1
|
|
|
<?php |
|
2
|
|
|
namespace Dropbox\Models; |
|
3
|
|
|
|
|
4
|
|
|
class FileMetadata extends BaseModel |
|
5
|
|
|
{ |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* A unique identifier of the file |
|
9
|
|
|
* |
|
10
|
|
|
* @var string |
|
11
|
|
|
*/ |
|
12
|
|
|
protected $id; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Object type |
|
16
|
|
|
* |
|
17
|
|
|
* @var string |
|
18
|
|
|
*/ |
|
19
|
|
|
protected $tag; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* The last component of the path (including extension). |
|
23
|
|
|
* |
|
24
|
|
|
* @var string |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $name; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* A unique identifier for the current revision of a file. |
|
30
|
|
|
* This field is the same rev as elsewhere in the API and |
|
31
|
|
|
* can be used to detect changes and avoid conflicts. |
|
32
|
|
|
* |
|
33
|
|
|
* @var string |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $rev; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* The file size in bytes. |
|
39
|
|
|
* |
|
40
|
|
|
* @var int |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $size; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* The lowercased full path in the user's Dropbox. |
|
46
|
|
|
* |
|
47
|
|
|
* @var string |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $path_lower; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Additional information if the file is a photo or video. |
|
53
|
|
|
* |
|
54
|
|
|
* @var \Dropbox\Models\MediaInfo |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $media_info; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Set if this file is contained in a shared folder. |
|
60
|
|
|
* |
|
61
|
|
|
* @var \Dropbox\Models\FileSharingInfo |
|
62
|
|
|
*/ |
|
63
|
|
|
protected $sharing_info; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* The cased path to be used for display purposes only. |
|
67
|
|
|
* |
|
68
|
|
|
* @var string |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $path_display; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* For files, this is the modification time set by the |
|
74
|
|
|
* desktop client when the file was added to Dropbox. |
|
75
|
|
|
* |
|
76
|
|
|
* @var string |
|
77
|
|
|
*/ |
|
78
|
|
|
protected $client_modified; |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* The last time the file was modified on Dropbox. |
|
82
|
|
|
* |
|
83
|
|
|
* @var string |
|
84
|
|
|
*/ |
|
85
|
|
|
protected $server_modified; |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* This flag will only be present if |
|
89
|
|
|
* include_has_explicit_shared_members is true in |
|
90
|
|
|
* list_folder or get_metadata. If this flag is present, |
|
91
|
|
|
* it will be true if this file has any explicit shared |
|
92
|
|
|
* members. This is different from sharing_info in that |
|
93
|
|
|
* this could be true in the case where a file has explicit |
|
94
|
|
|
* members but is not contained within a shared folder. |
|
95
|
|
|
* |
|
96
|
|
|
* @var bool |
|
97
|
|
|
*/ |
|
98
|
|
|
protected $has_explicit_shared_members; |
|
99
|
|
|
|
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* Create a new FileMetadata instance |
|
103
|
|
|
* |
|
104
|
|
|
* @param array $data |
|
105
|
|
|
*/ |
|
106
|
24 |
|
public function __construct(array $data) |
|
107
|
|
|
{ |
|
108
|
24 |
|
parent::__construct($data); |
|
109
|
24 |
|
$this->id = $this->getDataProperty('id'); |
|
110
|
24 |
|
$this->tag = $this->getDataProperty('.tag'); |
|
111
|
24 |
|
$this->rev = $this->getDataProperty('rev'); |
|
112
|
24 |
|
$this->name = $this->getDataProperty('name'); |
|
113
|
24 |
|
$this->size = $this->getDataProperty('size'); |
|
114
|
24 |
|
$this->path_lower = $this->getDataProperty('path_lower'); |
|
115
|
24 |
|
$this->path_display = $this->getDataProperty('path_display'); |
|
116
|
24 |
|
$this->client_modified = $this->getDataProperty('client_modified'); |
|
117
|
24 |
|
$this->server_modified = $this->getDataProperty('server_modified'); |
|
118
|
24 |
|
$this->has_explicit_shared_members = $this->getDataProperty('has_explicit_shared_members'); |
|
119
|
|
|
|
|
120
|
|
|
//Make MediaInfo |
|
121
|
24 |
|
$mediaInfo = $this->getDataProperty('media_info'); |
|
122
|
24 |
|
if (is_array($mediaInfo)) { |
|
123
|
|
|
$this->media_info = new MediaInfo($mediaInfo); |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
//Make SharingInfo |
|
127
|
24 |
|
$sharingInfo = $this->getDataProperty('sharing_info'); |
|
128
|
24 |
|
if (is_array($sharingInfo)) { |
|
129
|
3 |
|
$this->sharing_info = new FileSharingInfo($sharingInfo); |
|
130
|
|
|
} |
|
131
|
24 |
|
} |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* Get the 'id' property of the file model. |
|
135
|
|
|
* |
|
136
|
|
|
* @return string |
|
137
|
|
|
*/ |
|
138
|
4 |
|
public function getId() |
|
139
|
|
|
{ |
|
140
|
4 |
|
return $this->id; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* Get the '.tag' property of the file model. |
|
145
|
|
|
* |
|
146
|
|
|
* @return string |
|
147
|
|
|
*/ |
|
148
|
|
|
public function getTag() |
|
149
|
|
|
{ |
|
150
|
|
|
return $this->tag; |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* Get the 'name' property of the file model. |
|
155
|
|
|
* |
|
156
|
|
|
* @return string |
|
157
|
|
|
*/ |
|
158
|
2 |
|
public function getName() |
|
159
|
|
|
{ |
|
160
|
2 |
|
return $this->name; |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* Get the 'rev' property of the file model. |
|
165
|
|
|
* |
|
166
|
|
|
* @return string |
|
167
|
|
|
*/ |
|
168
|
2 |
|
public function getRev() |
|
169
|
|
|
{ |
|
170
|
2 |
|
return $this->rev; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* Get the 'size' property of the file model. |
|
175
|
|
|
* |
|
176
|
|
|
* @return int |
|
177
|
|
|
*/ |
|
178
|
|
|
public function getSize() |
|
179
|
|
|
{ |
|
180
|
|
|
return $this->size; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* Get the 'path_lower' property of the file model. |
|
185
|
|
|
* |
|
186
|
|
|
* @return string |
|
187
|
|
|
*/ |
|
188
|
17 |
|
public function getPathLower() |
|
189
|
|
|
{ |
|
190
|
17 |
|
return $this->path_lower; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* Get the 'media_info' property of the file model. |
|
195
|
|
|
* |
|
196
|
|
|
* @return \Dropbox\Models\MediaInfo |
|
197
|
|
|
*/ |
|
198
|
|
|
public function getMediaInfo() |
|
199
|
|
|
{ |
|
200
|
|
|
return $this->media_info; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
/** |
|
204
|
|
|
* Get the 'sharing_info' property of the file model. |
|
205
|
|
|
* |
|
206
|
|
|
* @return \Dropbox\Models\FileSharingInfo |
|
207
|
|
|
*/ |
|
208
|
|
|
public function getSharingInfo() |
|
209
|
|
|
{ |
|
210
|
|
|
return $this->sharing_info; |
|
211
|
|
|
} |
|
212
|
|
|
|
|
213
|
|
|
/** |
|
214
|
|
|
* Get the 'path_display' property of the file model. |
|
215
|
|
|
* |
|
216
|
|
|
* @return string |
|
217
|
|
|
*/ |
|
218
|
2 |
|
public function getPathDisplay() |
|
219
|
|
|
{ |
|
220
|
2 |
|
return $this->path_display; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* Get the 'client_modified' property of the file model. |
|
225
|
|
|
* |
|
226
|
|
|
* @return string |
|
227
|
|
|
*/ |
|
228
|
|
|
public function getClientModified() |
|
229
|
|
|
{ |
|
230
|
|
|
return $this->client_modified; |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
|
/** |
|
234
|
|
|
* Get the 'server_modified' property of the file model. |
|
235
|
|
|
* |
|
236
|
|
|
* @return string |
|
237
|
|
|
*/ |
|
238
|
|
|
public function getServerModified() |
|
239
|
|
|
{ |
|
240
|
|
|
return $this->server_modified; |
|
241
|
|
|
} |
|
242
|
|
|
|
|
243
|
|
|
/** |
|
244
|
|
|
* Get the 'has_explicit_shared_members' property of the file model. |
|
245
|
|
|
* |
|
246
|
|
|
* @return bool |
|
247
|
|
|
*/ |
|
248
|
|
|
public function hasExplicitSharedMembers() |
|
249
|
|
|
{ |
|
250
|
|
|
return $this->has_explicit_shared_members; |
|
251
|
|
|
} |
|
252
|
|
|
} |
|
253
|
|
|
|