Passed
Push — master ( 4bf53d...ce4836 )
by Sys
09:47
created

Versions   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 41
c 1
b 0
f 0
dl 0
loc 48
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getVersionFromText() 0 8 2
1
<?php
2
3
4
namespace TgScraper\Constants;
5
6
7
class Versions
8
{
9
10
    public const V100 = 'https://web.archive.org/web/20150714025308/https://core.telegram.org/bots/api/';
11
    public const V110 = 'https://web.archive.org/web/20150812125616/https://core.telegram.org/bots/api';
12
    public const V140 = 'https://web.archive.org/web/20150909214252/https://core.telegram.org/bots/api';
13
    public const V150 = 'https://web.archive.org/web/20150921091215/https://core.telegram.org/bots/api/';
14
    public const V160 = 'https://web.archive.org/web/20151023071257/https://core.telegram.org/bots/api';
15
    public const V180 = 'https://web.archive.org/web/20160112101045/https://core.telegram.org/bots/api';
16
    public const V182 = 'https://web.archive.org/web/20160126005312/https://core.telegram.org/bots/api';
17
    public const V183 = 'https://web.archive.org/web/20160305132243/https://core.telegram.org/bots/api';
18
    public const V200 = 'https://web.archive.org/web/20160413101342/https://core.telegram.org/bots/api';
19
    public const V210 = 'https://web.archive.org/web/20160912130321/https://core.telegram.org/bots/api';
20
    public const V211 = self::V210;
21
    public const V220 = 'https://web.archive.org/web/20161004150232/https://core.telegram.org/bots/api';
22
    public const V230 = 'https://web.archive.org/web/20161124162115/https://core.telegram.org/bots/api';
23
    public const V231 = 'https://web.archive.org/web/20161204181811/https://core.telegram.org/bots/api';
24
    public const V300 = 'https://web.archive.org/web/20170612094628/https://core.telegram.org/bots/api';
25
    public const V310 = 'https://web.archive.org/web/20170703123052/https://core.telegram.org/bots/api';
26
    public const V320 = 'https://web.archive.org/web/20170819054238/https://core.telegram.org/bots/api';
27
    public const V330 = 'https://web.archive.org/web/20170914060628/https://core.telegram.org/bots/api';
28
    public const V350 = 'https://web.archive.org/web/20171201065426/https://core.telegram.org/bots/api';
29
    public const V360 = 'https://web.archive.org/web/20180217001114/https://core.telegram.org/bots/api';
30
    public const V400 = 'https://web.archive.org/web/20180728174553/https://core.telegram.org/bots/api';
31
    public const V410 = 'https://web.archive.org/web/20180828155646/https://core.telegram.org/bots/api';
32
    public const V420 = 'https://web.archive.org/web/20190417160652/https://core.telegram.org/bots/api';
33
    public const V430 = 'https://web.archive.org/web/20190601122107/https://core.telegram.org/bots/api';
34
    public const V440 = 'https://web.archive.org/web/20190731114703/https://core.telegram.org/bots/api';
35
    public const V450 = 'https://web.archive.org/web/20200107090812/https://core.telegram.org/bots/api';
36
    public const V460 = 'https://web.archive.org/web/20200208225346/https://core.telegram.org/bots/api';
37
    public const V470 = 'https://web.archive.org/web/20200401052001/https://core.telegram.org/bots/api';
38
    public const V480 = 'https://web.archive.org/web/20200429054924/https://core.telegram.org/bots/api';
39
    public const V490 = 'https://web.archive.org/web/20200611131321/https://core.telegram.org/bots/api';
40
    public const V500 = 'https://web.archive.org/web/20201104151640/https://core.telegram.org/bots/api';
41
    public const V510 = 'https://web.archive.org/web/20210315055600/https://core.telegram.org/bots/api';
42
    public const V520 = 'https://web.archive.org/web/20210428145432/https://core.telegram.org/bots/api';
43
    public const V530 = 'https://web.archive.org/web/20210626142851/https://core.telegram.org/bots/api';
44
    public const LATEST = 'https://core.telegram.org/bots/api';
45
46
47
    public static function getVersionFromText(string $text): string
48
    {
49
        $text = str_replace('.', '', $text);
50
        $const = sprintf('%s::V%s', self::class, $text);
51
        if (defined($const)) {
52
            return constant($const);
53
        }
54
        return self::LATEST;
55
    }
56
57
}