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