Completed
Push — master ( 486315...705061 )
by Michael
01:25
created

GarminFitSdkMapping   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 136
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 136
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
B getMapping() 0 112 1
A __construct() 0 4 1
A toInternal() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Runalyze Device List.
5
 *
6
 * (c) RUNALYZE <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Runalyze\Devices\Mapping;
13
14
use Runalyze\Devices\Device\DeviceProfile;
15
16
class GarminFitSdkMapping
17
{
18
    /** @var int[]|string[] */
19
    protected $Mapping = [];
20
21 1
    protected function getMapping()
22
    {
23
        return [
24 1
            2266 => DeviceProfile::GARMIN_APPROACH_S_20,
25
            1936 => DeviceProfile::GARMIN_APPROACH_S_6,
26
            2262 => DeviceProfile::GARMIN_D_2_BRAVO,
27
            2547 => DeviceProfile::GARMIN_D_2_BRAVO_TITANIUM,
28
            2530 => DeviceProfile::GARMIN_EDGE_820,
29
            2204 => DeviceProfile::GARMIN_EDGE_EXPLORE_1000,
30
            2531 => DeviceProfile::GARMIN_EDGE_EXPLORE_820,
31
            1736 => DeviceProfile::GARMIN_EDGE_TOURING,
32
            1836 => DeviceProfile::GARMIN_EDGE_1000,
33
            2070 => DeviceProfile::GARMIN_EDGE_1000,
34
            2053 => DeviceProfile::GARMIN_EDGE_1000,
35
            2100 => DeviceProfile::GARMIN_EDGE_1000,
36
            2052 => DeviceProfile::GARMIN_EDGE_1000,
37
            2238 => DeviceProfile::GARMIN_EDGE_20,
38
            1325 => DeviceProfile::GARMIN_EDGE_200,
39
            1555 => DeviceProfile::GARMIN_EDGE_200,
40
            2147 => DeviceProfile::GARMIN_EDGE_25,
41
            1036 => DeviceProfile::GARMIN_EDGE_500,
42
            1387 => DeviceProfile::GARMIN_EDGE_500,
43
            1213 => DeviceProfile::GARMIN_EDGE_500,
44
            1422 => DeviceProfile::GARMIN_EDGE_500,
45
            1199 => DeviceProfile::GARMIN_EDGE_500,
46
            1561 => DeviceProfile::GARMIN_EDGE_510,
47
            1821 => DeviceProfile::GARMIN_EDGE_510,
48
            1742 => DeviceProfile::GARMIN_EDGE_510,
49
            1918 => DeviceProfile::GARMIN_EDGE_510,
50
            2067 => DeviceProfile::GARMIN_EDGE_520,
51
            1169 => DeviceProfile::GARMIN_EDGE_800,
52
            1386 => DeviceProfile::GARMIN_EDGE_800,
53
            1334 => DeviceProfile::GARMIN_EDGE_800,
54
            1497 => DeviceProfile::GARMIN_EDGE_800,
55
            1333 => DeviceProfile::GARMIN_EDGE_800,
56
            1567 => DeviceProfile::GARMIN_EDGE_810,
57
            1822 => DeviceProfile::GARMIN_EDGE_810,
58
            1721 => DeviceProfile::GARMIN_EDGE_810,
59
            1823 => DeviceProfile::GARMIN_EDGE_810,
60
            1988 => DeviceProfile::GARMIN_EPIX,
61
            2140 => DeviceProfile::GARMIN_ETREX_TOUCH,
62
            1551 => DeviceProfile::GARMIN_FENIX,
63
            1967 => DeviceProfile::GARMIN_FENIX_2,
64
            2050 => DeviceProfile::GARMIN_FENIX_3,
65
            2188 => DeviceProfile::GARMIN_FENIX_3,
66
            2189 => DeviceProfile::GARMIN_FENIX_3,
67
            2432 => DeviceProfile::GARMIN_FENIX_3,
68
            2413 => DeviceProfile::GARMIN_FENIX_3_H_R,
69
            2697 => DeviceProfile::GARMIN_FENIX_5,
70
            2544 => DeviceProfile::GARMIN_FENIX_5_S,
71
            2604 => DeviceProfile::GARMIN_FENIX_5_X,
72
            1482 => DeviceProfile::GARMIN_FORERUNNER_10,
73
            1688 => DeviceProfile::GARMIN_FORERUNNER_10,
74
            1124 => DeviceProfile::GARMIN_FORERUNNER_110,
75
            1274 => DeviceProfile::GARMIN_FORERUNNER_110,
76
            1903 => DeviceProfile::GARMIN_FORERUNNER_15,
77
            2061 => DeviceProfile::GARMIN_FORERUNNER_15,
78
            1360 => DeviceProfile::GARMIN_FORERUNNER_210,
79
            1631 => DeviceProfile::GARMIN_FORERUNNER_220,
80
            1931 => DeviceProfile::GARMIN_FORERUNNER_220,
81
            1930 => DeviceProfile::GARMIN_FORERUNNER_220,
82
            2073 => DeviceProfile::GARMIN_FORERUNNER_220,
83
            2174 => DeviceProfile::GARMIN_FORERUNNER_220,
84
            2153 => DeviceProfile::GARMIN_FORERUNNER_225,
85
            2219 => DeviceProfile::GARMIN_FORERUNNER_225,
86
            14 => DeviceProfile::GARMIN_FORERUNNER_225,
87
            2157 => DeviceProfile::GARMIN_FORERUNNER_230,
88
            2431 => DeviceProfile::GARMIN_FORERUNNER_235,
89
            2148 => DeviceProfile::GARMIN_FORERUNNER_25,
90
            473 => DeviceProfile::GARMIN_FORERUNNER_301,
91
            474 => DeviceProfile::GARMIN_FORERUNNER_301,
92
            475 => DeviceProfile::GARMIN_FORERUNNER_301,
93
            494 => DeviceProfile::GARMIN_FORERUNNER_301,
94
            1018 => DeviceProfile::GARMIN_FORERUNNER_310_X_T,
95
            1446 => DeviceProfile::GARMIN_FORERUNNER_310_X_T,
96
            717 => DeviceProfile::GARMIN_FORERUNNER_405,
97
            987 => DeviceProfile::GARMIN_FORERUNNER_405,
98
            782 => DeviceProfile::GARMIN_FORERUNNER_50,
99
            988 => DeviceProfile::GARMIN_FORERUNNER_60,
100
            1345 => DeviceProfile::GARMIN_FORERUNNER_610,
101
            1410 => DeviceProfile::GARMIN_FORERUNNER_610,
102
            1623 => DeviceProfile::GARMIN_FORERUNNER_620,
103
            1929 => DeviceProfile::GARMIN_FORERUNNER_620,
104
            1928 => DeviceProfile::GARMIN_FORERUNNER_620,
105
            2072 => DeviceProfile::GARMIN_FORERUNNER_620,
106
            2173 => DeviceProfile::GARMIN_FORERUNNER_620,
107
            2156 => DeviceProfile::GARMIN_FORERUNNER_630,
108
            1436 => DeviceProfile::GARMIN_FORERUNNER_70,
109
            1328 => DeviceProfile::GARMIN_FORERUNNER_910_X_T,
110
            1537 => DeviceProfile::GARMIN_FORERUNNER_910_X_T,
111
            1600 => DeviceProfile::GARMIN_FORERUNNER_910_X_T,
112
            1664 => DeviceProfile::GARMIN_FORERUNNER_910_X_T,
113
            1765 => DeviceProfile::GARMIN_FORERUNNER_920_X_T,
114
            2131 => DeviceProfile::GARMIN_FORERUNNER_920_X_T,
115
            2132 => DeviceProfile::GARMIN_FORERUNNER_920_X_T,
116
            2130 => DeviceProfile::GARMIN_FORERUNNER_920_X_T,
117
            2691 => DeviceProfile::GARMIN_FORERUNNER_935_X_T,
118
            1499 => DeviceProfile::GARMIN_SWIM,
119
            1907 => DeviceProfile::GARMIN_VIVO_ACTIVE,
120
            2160 => DeviceProfile::GARMIN_VIVO_ACTIVE,
121
            2337 => DeviceProfile::GARMIN_VIVO_ACTIVE_H_R,
122
            1837 => DeviceProfile::GARMIN_VIVO_FIT,
123
            2606 => DeviceProfile::GARMIN_VIVO_FIT_JR,
124
            2150 => DeviceProfile::GARMIN_VIVO_FIT_2,
125
            2406 => DeviceProfile::GARMIN_VIVO_FIT_3,
126
            2368 => DeviceProfile::GARMIN_VIVO_MOVE,
127
            1956 => DeviceProfile::GARMIN_VIVO_SMART,
128
            2135 => DeviceProfile::GARMIN_VIVO_SMART,
129
            2347 => DeviceProfile::GARMIN_VIVO_SMART_GPS_H_R,
130
            2348 => DeviceProfile::GARMIN_VIVO_SMART_H_R,
131
        ];
132
    }
133
134 1
    public function __construct()
135
    {
136 1
        $this->Mapping = $this->getMapping();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMapping() of type array<integer,?> is incompatible with the declared type array<integer,integer|string> of property $Mapping.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
137 1
    }
138
139
    /**
140
     * @param  int|string $value
141
     * @return int|string
142
     */
143 1
    public function toInternal($value)
144
    {
145 1
        if (isset($this->Mapping[$value])) {
146 1
            return $this->Mapping[$value];
147
        }
148
149 1
        return;
150
    }
151
}
152