1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TgScraper\Constants; |
4
|
|
|
|
5
|
|
|
class Versions |
6
|
|
|
{ |
7
|
|
|
public const V100 = '1.0.0'; |
8
|
|
|
public const V110 = '1.1.0'; |
9
|
|
|
public const V140 = '1.4.0'; |
10
|
|
|
public const V150 = '1.5.0'; |
11
|
|
|
public const V160 = '1.6.0'; |
12
|
|
|
public const V180 = '1.8.0'; |
13
|
|
|
public const V182 = '1.8.2'; |
14
|
|
|
public const V183 = '1.8.3'; |
15
|
|
|
public const V200 = '2.0.0'; |
16
|
|
|
public const V210 = '2.1.0'; |
17
|
|
|
public const V211 = '2.1.1'; |
18
|
|
|
public const V220 = '2.2.0'; |
19
|
|
|
public const V230 = '2.3.0'; |
20
|
|
|
public const V231 = '2.3.1'; |
21
|
|
|
public const V300 = '3.0.0'; |
22
|
|
|
public const V310 = '3.1.0'; |
23
|
|
|
public const V320 = '3.2.0'; |
24
|
|
|
public const V330 = '3.3.0'; |
25
|
|
|
public const V350 = '3.5.0'; |
26
|
|
|
public const V360 = '3.6.0'; |
27
|
|
|
public const V400 = '4.0.0'; |
28
|
|
|
public const V410 = '4.1.0'; |
29
|
|
|
public const V420 = '4.2.0'; |
30
|
|
|
public const V430 = '4.3.0'; |
31
|
|
|
public const V440 = '4.4.0'; |
32
|
|
|
public const V450 = '4.5.0'; |
33
|
|
|
public const V460 = '4.6.0'; |
34
|
|
|
public const V470 = '4.7.0'; |
35
|
|
|
public const V480 = '4.8.0'; |
36
|
|
|
public const V490 = '4.9.0'; |
37
|
|
|
public const V500 = '5.0.0'; |
38
|
|
|
public const V510 = '5.1.0'; |
39
|
|
|
public const V520 = '5.2.0'; |
40
|
|
|
public const V530 = '5.3.0'; |
41
|
|
|
public const V540 = '5.4.0'; |
42
|
|
|
public const V550 = '5.5.0'; |
43
|
|
|
public const V560 = '5.6.0'; |
44
|
|
|
public const V570 = '5.7.0'; |
45
|
|
|
public const V600 = '6.0.0'; |
46
|
|
|
public const V610 = '6.1.0'; |
47
|
|
|
public const V620 = '6.2.0'; |
48
|
|
|
public const V630 = '6.3.0'; |
49
|
|
|
public const V640 = '6.4.0'; |
50
|
|
|
public const V650 = '6.5.0'; |
51
|
|
|
public const V660 = '6.6.0'; |
52
|
|
|
public const V670 = '6.7.0'; |
53
|
|
|
public const V680 = '6.8.0'; |
54
|
|
|
public const V690 = '6.9.0'; |
55
|
|
|
public const V700 = '7.0.0'; |
56
|
|
|
public const V710 = '7.1.0'; |
57
|
|
|
public const V720 = '7.2.0'; |
58
|
|
|
public const V730 = '7.3.0'; |
59
|
|
|
public const V740 = '7.4.0'; |
60
|
|
|
public const V750 = '7.5.0'; |
61
|
|
|
public const V760 = '7.6.0'; |
62
|
|
|
public const LATEST = 'latest'; |
63
|
|
|
public const STABLE = self::V760; |
64
|
|
|
|
65
|
|
|
public const URLS = [ |
66
|
|
|
self::V100 => 'https://web.archive.org/web/20150714025308id_/https://core.telegram.org/bots/api/', |
67
|
|
|
self::V110 => 'https://web.archive.org/web/20150812125616id_/https://core.telegram.org/bots/api', |
68
|
|
|
self::V140 => 'https://web.archive.org/web/20150909214252id_/https://core.telegram.org/bots/api', |
69
|
|
|
self::V150 => 'https://web.archive.org/web/20150921091215id_/https://core.telegram.org/bots/api/', |
70
|
|
|
self::V160 => 'https://web.archive.org/web/20151023071257id_/https://core.telegram.org/bots/api', |
71
|
|
|
self::V180 => 'https://web.archive.org/web/20160112101045id_/https://core.telegram.org/bots/api', |
72
|
|
|
self::V182 => 'https://web.archive.org/web/20160126005312id_/https://core.telegram.org/bots/api', |
73
|
|
|
self::V183 => 'https://web.archive.org/web/20160305132243id_/https://core.telegram.org/bots/api', |
74
|
|
|
self::V200 => 'https://web.archive.org/web/20160413101342id_/https://core.telegram.org/bots/api', |
75
|
|
|
self::V210 => 'https://web.archive.org/web/20160912130321id_/https://core.telegram.org/bots/api', |
76
|
|
|
self::V211 => 'https://web.archive.org/web/20160912130321id_/https://core.telegram.org/bots/api', |
77
|
|
|
self::V220 => 'https://web.archive.org/web/20161004150232id_/https://core.telegram.org/bots/api', |
78
|
|
|
self::V230 => 'https://web.archive.org/web/20161124162115id_/https://core.telegram.org/bots/api', |
79
|
|
|
self::V231 => 'https://web.archive.org/web/20161204181811id_/https://core.telegram.org/bots/api', |
80
|
|
|
self::V300 => 'https://web.archive.org/web/20170612094628id_/https://core.telegram.org/bots/api', |
81
|
|
|
self::V310 => 'https://web.archive.org/web/20170703123052id_/https://core.telegram.org/bots/api', |
82
|
|
|
self::V320 => 'https://web.archive.org/web/20170819054238id_/https://core.telegram.org/bots/api', |
83
|
|
|
self::V330 => 'https://web.archive.org/web/20170914060628id_/https://core.telegram.org/bots/api', |
84
|
|
|
self::V350 => 'https://web.archive.org/web/20171201065426id_/https://core.telegram.org/bots/api', |
85
|
|
|
self::V360 => 'https://web.archive.org/web/20180217001114id_/https://core.telegram.org/bots/api', |
86
|
|
|
self::V400 => 'https://web.archive.org/web/20180728174553id_/https://core.telegram.org/bots/api', |
87
|
|
|
self::V410 => 'https://web.archive.org/web/20180828155646id_/https://core.telegram.org/bots/api', |
88
|
|
|
self::V420 => 'https://web.archive.org/web/20190417160652id_/https://core.telegram.org/bots/api', |
89
|
|
|
self::V430 => 'https://web.archive.org/web/20190601122107id_/https://core.telegram.org/bots/api', |
90
|
|
|
self::V440 => 'https://web.archive.org/web/20190731114703id_/https://core.telegram.org/bots/api', |
91
|
|
|
self::V450 => 'https://web.archive.org/web/20200107090812id_/https://core.telegram.org/bots/api', |
92
|
|
|
self::V460 => 'https://web.archive.org/web/20200208225346id_/https://core.telegram.org/bots/api', |
93
|
|
|
self::V470 => 'https://web.archive.org/web/20200401052001id_/https://core.telegram.org/bots/api', |
94
|
|
|
self::V480 => 'https://web.archive.org/web/20200429054924id_/https://core.telegram.org/bots/api', |
95
|
|
|
self::V490 => 'https://web.archive.org/web/20200611131321id_/https://core.telegram.org/bots/api', |
96
|
|
|
self::V500 => 'https://web.archive.org/web/20201104151640id_/https://core.telegram.org/bots/api', |
97
|
|
|
self::V510 => 'https://web.archive.org/web/20210315055600id_/https://core.telegram.org/bots/api', |
98
|
|
|
self::V520 => 'https://web.archive.org/web/20210428195636id_/https://core.telegram.org/bots/api', |
99
|
|
|
self::V530 => 'https://web.archive.org/web/20210626142851id_/https://core.telegram.org/bots/api', |
100
|
|
|
self::V540 => 'https://web.archive.org/web/20211105152638id_/https://core.telegram.org/bots/api', |
101
|
|
|
self::V550 => 'https://web.archive.org/web/20211211002657id_/https://core.telegram.org/bots/api', |
102
|
|
|
self::V560 => 'https://web.archive.org/web/20220105131529id_/https://core.telegram.org/bots/api', |
103
|
|
|
self::V570 => 'https://web.archive.org/web/20220206103922id_/https://core.telegram.org/bots/api', |
104
|
|
|
self::V600 => 'https://web.archive.org/web/20220416143511id_/https://core.telegram.org/bots/api', |
105
|
|
|
self::V610 => 'https://web.archive.org/web/20220621093855id_/https://core.telegram.org/bots/api', |
106
|
|
|
self::V620 => 'https://web.archive.org/web/20220812143250id_/https://core.telegram.org/bots/api', |
107
|
|
|
self::V630 => 'https://web.archive.org/web/20221105155229id_/https://core.telegram.org/bots/api', |
108
|
|
|
self::V640 => 'https://web.archive.org/web/20221230181046id_/https://core.telegram.org/bots/api', |
109
|
|
|
self::V650 => 'https://web.archive.org/web/20230204145800id_/https://core.telegram.org/bots/api', |
110
|
|
|
self::V660 => 'https://web.archive.org/web/20230314174834id_/https://core.telegram.org/bots/api', |
111
|
|
|
self::V670 => 'https://web.archive.org/web/20230422225636id_/https://core.telegram.org/bots/api', |
112
|
|
|
self::V680 => 'https://web.archive.org/web/20230823081042id_/https://core.telegram.org/bots/api', |
113
|
|
|
self::V690 => 'https://web.archive.org/web/20230923182249id_/https://core.telegram.org/bots/api', |
114
|
|
|
self::V700 => 'https://web.archive.org/web/20240101113402id_/https://core.telegram.org/bots/api', |
115
|
|
|
self::V710 => 'https://web.archive.org/web/20240217084100id_/https://core.telegram.org/bots/api', |
116
|
|
|
self::V720 => 'https://web.archive.org/web/20240402153812id_/https://core.telegram.org/bots/api', |
117
|
|
|
self::V730 => 'https://web.archive.org/web/20240507163328id_/https://core.telegram.org/bots/api', |
118
|
|
|
self::V740 => 'https://web.archive.org/web/20240529172355id_/https://core.telegram.org/bots/api', |
119
|
|
|
self::V750 => 'https://web.archive.org/web/20240624102326id_/https://core.telegram.org/bots/api', |
120
|
|
|
self::V760 => 'https://web.archive.org/web/20240702102244id_/https://core.telegram.org/bots/api', |
121
|
|
|
self::LATEST => 'https://core.telegram.org/bots/api' |
122
|
|
|
]; |
123
|
|
|
|
124
|
|
|
public static function getVersionFromText(string $text): string |
125
|
|
|
{ |
126
|
|
|
$text = str_replace(['.', 'v'], ['', ''], strtolower($text)); |
127
|
|
|
$const = sprintf('%s::V%s', self::class, $text); |
128
|
|
|
if (defined($const)) { |
129
|
|
|
return constant($const); |
130
|
|
|
} |
131
|
|
|
return self::LATEST; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public static function getUrlFromText(string $text): string |
135
|
|
|
{ |
136
|
|
|
$version = self::getVersionFromText($text); |
137
|
|
|
return self::URLS[$version] ?? self::URLS[self::LATEST]; |
138
|
|
|
} |
139
|
|
|
} |
140
|
|
|
|