1
|
|
|
<?php |
2
|
|
|
namespace Kunnu\Dropbox\Models; |
3
|
|
|
|
4
|
|
|
class FolderMetadata extends BaseModel |
5
|
|
|
{ |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* A unique identifier of the folder |
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
|
|
|
* This never contains a slash. |
24
|
|
|
* |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
protected $name; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The lowercased full path in the user's Dropbox. |
31
|
|
|
* This always starts with a slash. |
32
|
|
|
* |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
protected $path_lower; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Set if this folder is contained in a shared folder. |
39
|
|
|
* |
40
|
|
|
* @var \Kunnu\Dropbox\Models\FolderSharingInfo |
41
|
|
|
*/ |
42
|
|
|
protected $sharing_info; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* The cased path to be used for display purposes only. |
46
|
|
|
* |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
protected $path_display; |
50
|
|
|
|
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Create a new FolderMetadata instance |
54
|
|
|
* |
55
|
|
|
* @param array $data |
56
|
|
|
*/ |
57
|
1 |
|
public function __construct(array $data) |
58
|
|
|
{ |
59
|
1 |
|
parent::__construct($data); |
60
|
1 |
|
$this->id = $this->getDataProperty('id'); |
61
|
1 |
|
$this->tag = $this->getDataProperty('.tag'); |
62
|
1 |
|
$this->name = $this->getDataProperty('name'); |
63
|
1 |
|
$this->path_lower = $this->getDataProperty('path_lower'); |
64
|
1 |
|
$this->path_display = $this->getDataProperty('path_display'); |
65
|
|
|
|
66
|
|
|
//Make SharingInfo |
67
|
1 |
|
$sharingInfo = $this->getDataProperty('sharing_info'); |
68
|
1 |
|
if (is_array($sharingInfo)) { |
69
|
|
|
$this->sharing_info = new FolderSharingInfo($sharingInfo); |
70
|
|
|
} |
71
|
1 |
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Get the 'id' property of the folder model. |
75
|
|
|
* |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
1 |
|
public function getId() |
79
|
|
|
{ |
80
|
1 |
|
return $this->id; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Get the '.tag' property of the folder model. |
85
|
|
|
* |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
|
|
public function getTag() |
89
|
|
|
{ |
90
|
|
|
return $this->tag; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Get the 'name' property of the folder model. |
95
|
|
|
* |
96
|
|
|
* @return string |
97
|
|
|
*/ |
98
|
1 |
|
public function getName() |
99
|
|
|
{ |
100
|
1 |
|
return $this->name; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Get the 'path_lower' property of the folder model. |
105
|
|
|
* |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
1 |
|
public function getPathLower() |
109
|
|
|
{ |
110
|
1 |
|
return $this->path_lower; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Get the 'sharing_info' property of the folder model. |
115
|
|
|
* |
116
|
|
|
* @return \Kunnu\Dropbox\Models\FolderSharingInfo |
117
|
|
|
*/ |
118
|
|
|
public function getSharingInfo() |
119
|
|
|
{ |
120
|
|
|
return $this->sharing_info; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Get the 'path_display' property of the folder model. |
125
|
|
|
* |
126
|
|
|
* @return string |
127
|
|
|
*/ |
128
|
|
|
public function getPathDisplay() |
129
|
|
|
{ |
130
|
|
|
return $this->path_display; |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
|