|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace BPT\types; |
|
4
|
|
|
|
|
5
|
|
|
use BPT\api\telegram; |
|
6
|
|
|
use stdClass; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* This object represents an audio file to be treated as music by the Telegram clients. |
|
10
|
|
|
*/ |
|
11
|
|
|
class audio extends types { |
|
|
|
|
|
|
12
|
|
|
/** Keep all of properties which has sub properties */ |
|
13
|
|
|
private const subs = ['thumb' => 'BPT\types\photoSize']; |
|
14
|
|
|
|
|
15
|
|
|
/** Identifier for this file, which can be used to download or reuse the file */ |
|
16
|
|
|
public string $file_id; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be |
|
20
|
|
|
* used to download or reuse the file. |
|
21
|
|
|
*/ |
|
22
|
|
|
public string $file_unique_id; |
|
23
|
|
|
|
|
24
|
|
|
/** Duration of the audio in seconds as defined by sender */ |
|
25
|
|
|
public int $duration; |
|
26
|
|
|
|
|
27
|
|
|
/** Optional. Performer of the audio as defined by sender or by audio tags */ |
|
28
|
|
|
public string $performer; |
|
29
|
|
|
|
|
30
|
|
|
/** Optional. Title of the audio as defined by sender or by audio tags */ |
|
31
|
|
|
public string $title; |
|
32
|
|
|
|
|
33
|
|
|
/** Optional. Original filename as defined by sender */ |
|
34
|
|
|
public string $file_name; |
|
35
|
|
|
|
|
36
|
|
|
/** Optional. MIME type of the file as defined by sender */ |
|
37
|
|
|
public string $mime_type; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have |
|
41
|
|
|
* difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit |
|
42
|
|
|
* integer or double-precision float type are safe for storing this value. |
|
43
|
|
|
*/ |
|
44
|
|
|
public int $file_size; |
|
45
|
|
|
|
|
46
|
|
|
/** Optional. Thumbnail of the album cover to which the music file belongs */ |
|
47
|
|
|
public photoSize $thumb; |
|
48
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
public function __construct(stdClass|null $object = null) { |
|
51
|
|
|
if ($object != null) { |
|
52
|
|
|
parent::__construct($object, self::subs); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* download this file and save it in destination |
|
58
|
|
|
* |
|
59
|
|
|
* if destination doesn't set , it will return the downloaded file(as string) |
|
60
|
|
|
* |
|
61
|
|
|
* It has 20MB download limit(same as telegram) |
|
62
|
|
|
* |
|
63
|
|
|
* e.g. => $audio->download(); |
|
64
|
|
|
* |
|
65
|
|
|
* e.g. => $audio->download('test.mp3'); |
|
66
|
|
|
* |
|
67
|
|
|
* @param string|null $destination destination for save the file |
|
68
|
|
|
* |
|
69
|
|
|
* @return bool|string string will be returned when destination doesn't set |
|
70
|
|
|
*/ |
|
71
|
|
|
public function download(string|null $destination = null): bool|string { |
|
72
|
|
|
return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp3',$this->file_id); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
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