|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace BPT\types; |
|
4
|
|
|
|
|
5
|
|
|
use BPT\api\telegram; |
|
6
|
|
|
use stdClass; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* This object represents a sticker. |
|
10
|
|
|
*/ |
|
11
|
|
|
class sticker extends types { |
|
|
|
|
|
|
12
|
|
|
/** Keep all of properties which has sub properties */ |
|
13
|
|
|
private const subs = [ |
|
14
|
|
|
'thumb' => 'BPT\types\photoSize', |
|
15
|
|
|
'premium_animation' => 'BPT\types\file', |
|
16
|
|
|
'mask_position' => 'BPT\types\maskPosition', |
|
17
|
|
|
]; |
|
18
|
|
|
|
|
19
|
|
|
/** Identifier for this file, which can be used to download or reuse the file */ |
|
20
|
|
|
public string $file_id; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be |
|
24
|
|
|
* used to download or reuse the file. |
|
25
|
|
|
*/ |
|
26
|
|
|
public string $file_unique_id; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is |
|
30
|
|
|
* independent from its format, which is determined by the fields is_animated and is_video. |
|
31
|
|
|
*/ |
|
32
|
|
|
public string $type; |
|
33
|
|
|
|
|
34
|
|
|
/** Sticker width */ |
|
35
|
|
|
public int $width; |
|
36
|
|
|
|
|
37
|
|
|
/** Sticker height */ |
|
38
|
|
|
public int $height; |
|
39
|
|
|
|
|
40
|
|
|
/** True, if the sticker is animated */ |
|
41
|
|
|
public bool $is_animated; |
|
42
|
|
|
|
|
43
|
|
|
/** True, if the sticker is a video sticker */ |
|
44
|
|
|
public bool $is_video; |
|
45
|
|
|
|
|
46
|
|
|
/** Optional. Sticker thumbnail in the .WEBP or .JPG format */ |
|
47
|
|
|
public photoSize $thumb; |
|
48
|
|
|
|
|
49
|
|
|
/** Optional. Emoji associated with the sticker */ |
|
50
|
|
|
public string $emoji; |
|
51
|
|
|
|
|
52
|
|
|
/** Optional. Name of the sticker set to which the sticker belongs */ |
|
53
|
|
|
public string $set_name; |
|
54
|
|
|
|
|
55
|
|
|
/** Optional. Premium animation for the sticker, if the sticker is premium */ |
|
56
|
|
|
public file $premium_animation; |
|
57
|
|
|
|
|
58
|
|
|
/** Optional. For mask stickers, the position where the mask should be placed */ |
|
59
|
|
|
public maskPosition $mask_position; |
|
60
|
|
|
|
|
61
|
|
|
/** Optional. For custom emoji stickers, unique identifier of the custom emoji */ |
|
62
|
|
|
public string $custom_emoji_id; |
|
63
|
|
|
|
|
64
|
|
|
/** Optional. File size in bytes */ |
|
65
|
|
|
public int $file_size; |
|
66
|
|
|
|
|
67
|
|
|
|
|
68
|
|
|
public function __construct(stdClass|null $object = null) { |
|
69
|
|
|
if ($object != null) { |
|
70
|
|
|
parent::__construct($object, self::subs); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* download this file and save it in destination |
|
76
|
|
|
* |
|
77
|
|
|
* if destination doesn't set , it will return the downloaded file(as string) |
|
78
|
|
|
* |
|
79
|
|
|
* It has 20MB download limit(same as telegram) |
|
80
|
|
|
* |
|
81
|
|
|
* e.g. => $sticker->download(); |
|
82
|
|
|
* |
|
83
|
|
|
* e.g. => $sticker->download('test.png'); |
|
84
|
|
|
* |
|
85
|
|
|
* @param string|null $destination destination for save the file |
|
86
|
|
|
* |
|
87
|
|
|
* @return bool|string string will be returned when destination doesn't set |
|
88
|
|
|
*/ |
|
89
|
|
|
public function download(string|null $destination = null): bool|string { |
|
90
|
|
|
return telegram::downloadFile($destination ?? 'unknown.png',$this->file_id); |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths