1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pnz\MattermostClient\Model\File; |
4
|
|
|
|
5
|
|
|
use Pnz\MattermostClient\Model\Model; |
6
|
|
|
|
7
|
|
|
class FileInfo extends Model |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* The unique identifier for this file. |
11
|
|
|
*/ |
12
|
|
|
public function getId(): string |
13
|
|
|
{ |
14
|
|
|
return $this->data['id']; |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* The ID of the user that uploaded this file. |
19
|
|
|
*/ |
20
|
|
|
public function getUserIdd(): string |
21
|
|
|
{ |
22
|
|
|
return $this->data['user_id']; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* If this file is attached to a post, the ID of that post. |
27
|
|
|
*/ |
28
|
|
|
public function getPostId(): string |
29
|
|
|
{ |
30
|
|
|
return $this->data['post_id']; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function getCreateAt(): integer |
34
|
|
|
{ |
35
|
|
|
return $this->data['create_at']; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function getUpdateAt(): integer |
39
|
|
|
{ |
40
|
|
|
return $this->data['update_at']; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function getDeleteAt(): integer |
44
|
|
|
{ |
45
|
|
|
return $this->data['delete_at']; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* The name of the file. |
50
|
|
|
*/ |
51
|
|
|
public function getName(): string |
52
|
|
|
{ |
53
|
|
|
return $this->data['name']; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* The extension at the end of the file name. |
58
|
|
|
*/ |
59
|
|
|
public function getExtension(): string |
60
|
|
|
{ |
61
|
|
|
return $this->data['extension']; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* The size of the file in bytes. |
66
|
|
|
*/ |
67
|
|
|
public function getSize(): integer |
68
|
|
|
{ |
69
|
|
|
return $this->data['size']; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* The MIME type of the file. |
74
|
|
|
*/ |
75
|
|
|
public function getMimeType(): string |
76
|
|
|
{ |
77
|
|
|
return $this->data['mime_type']; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* If this file is an image, the width of the file. |
82
|
|
|
*/ |
83
|
|
|
public function getWidth(): integer |
84
|
|
|
{ |
85
|
|
|
return $this->data['width']; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* If this file is an image, the height of the file. |
90
|
|
|
*/ |
91
|
|
|
public function getHeight(): integer |
92
|
|
|
{ |
93
|
|
|
return $this->data['height']; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* If this file is an image, whether or not it has a preview-sized version. |
98
|
|
|
*/ |
99
|
|
|
public function getHasPreviewImage(): boolean |
100
|
|
|
{ |
101
|
|
|
return $this->data['has_preview_image']; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* {@inheritdoc} |
106
|
|
|
*/ |
107
|
|
|
protected static function getFields() |
108
|
|
|
{ |
109
|
|
|
return [ |
110
|
|
|
'id', |
111
|
|
|
'user_id', |
112
|
|
|
'post_id', |
113
|
|
|
'create_at', |
114
|
|
|
'update_at', |
115
|
|
|
'delete_at', |
116
|
|
|
'name', |
117
|
|
|
'extension', |
118
|
|
|
'size', |
119
|
|
|
'mime_type', |
120
|
|
|
'width', |
121
|
|
|
'height', |
122
|
|
|
'has_preview_image', |
123
|
|
|
]; |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
|