Completed
Push — master ( d556ff...655133 )
by Michael
01:46
created

GarminFitSdkMapping::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
crap 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
    protected function getMapping()
22
    {
23
        return [
24
            2962 => DeviceProfile::GARMIN_APPROACH_X_10,
25
            2266 => DeviceProfile::GARMIN_APPROACH_S_20,
26
            3049 => DeviceProfile::GARMIN_APPROACH_S10,
27
            1936 => DeviceProfile::GARMIN_APPROACH_S_6,
28
            3085 => DeviceProfile::GARMIN_APPROACH_G_80,
29
            2292 => DeviceProfile::GARMIN_APPROACH_X_40,
30
            3314 => DeviceProfile::GARMIN_APPROACH_S_40,
31
            2656 => DeviceProfile::GARMIN_APPROACH_S_60,
32
            2907 => DeviceProfile::GARMIN_APPROACH_S_60,
33
            1405 => DeviceProfile::GARMIN_APPROACH_G_10,
34
            2859 => DeviceProfile::GARMIN_DESCENT_MK_1,
35
            2991 => DeviceProfile::GARMIN_DESCENT_MK_1,
36
            2262 => DeviceProfile::GARMIN_D_2_BRAVO,
37
            2547 => DeviceProfile::GARMIN_D_2_BRAVO_TITANIUM,
38
            2819 => DeviceProfile::GARMIN_D_2_CHARLIE,
39
            3011 => DeviceProfile::GARMIN_EDGE_EXPLORE,
40
            2204 => DeviceProfile::GARMIN_EDGE_EXPLORE_1000,
41
            2531 => DeviceProfile::GARMIN_EDGE_EXPLORE_820,
42
            1736 => DeviceProfile::GARMIN_EDGE_TOURING,
43
            2238 => DeviceProfile::GARMIN_EDGE_20,
44
            2290 => DeviceProfile::GARMIN_EDGE_20,
45
            2147 => DeviceProfile::GARMIN_EDGE_25,
46
            2288 => DeviceProfile::GARMIN_EDGE_25,
47
            2289 => DeviceProfile::GARMIN_EDGE_25,
48
            3092 => DeviceProfile::GARMIN_EDGE_130,
49
            2909 => DeviceProfile::GARMIN_EDGE_130,
50
            1325 => DeviceProfile::GARMIN_EDGE_200,
51
            1555 => DeviceProfile::GARMIN_EDGE_200,
52
            1036 => DeviceProfile::GARMIN_EDGE_500,
53
            1387 => DeviceProfile::GARMIN_EDGE_500,
54
            1213 => DeviceProfile::GARMIN_EDGE_500,
55
            1422 => DeviceProfile::GARMIN_EDGE_500,
56
            1199 => DeviceProfile::GARMIN_EDGE_500,
57
            1561 => DeviceProfile::GARMIN_EDGE_510,
58
            1821 => DeviceProfile::GARMIN_EDGE_510,
59
            1742 => DeviceProfile::GARMIN_EDGE_510,
60
            1918 => DeviceProfile::GARMIN_EDGE_510,
61
            2067 => DeviceProfile::GARMIN_EDGE_520,
62
            2260 => DeviceProfile::GARMIN_EDGE_520,
63
            2261 => DeviceProfile::GARMIN_EDGE_520,
64
            3349 => DeviceProfile::GARMIN_EDGE_530,
65
            3121 => DeviceProfile::GARMIN_EDGE_530,
66
            1169 => DeviceProfile::GARMIN_EDGE_800,
67
            1386 => DeviceProfile::GARMIN_EDGE_800,
68
            1334 => DeviceProfile::GARMIN_EDGE_800,
69
            1497 => DeviceProfile::GARMIN_EDGE_800,
70
            1333 => DeviceProfile::GARMIN_EDGE_800,
71
            1567 => DeviceProfile::GARMIN_EDGE_810,
72
            1822 => DeviceProfile::GARMIN_EDGE_810,
73
            1721 => DeviceProfile::GARMIN_EDGE_810,
74
            1823 => DeviceProfile::GARMIN_EDGE_810,
75
            2530 => DeviceProfile::GARMIN_EDGE_820,
76
            2599 => DeviceProfile::GARMIN_EDGE_820,
77
            2600 => DeviceProfile::GARMIN_EDGE_820,
78
            2628 => DeviceProfile::GARMIN_EDGE_820,
79
            2629 => DeviceProfile::GARMIN_EDGE_820,
80
            2630 => DeviceProfile::GARMIN_EDGE_820,
81
            3122 => DeviceProfile::GARMIN_EDGE_830,
82
            3350 => DeviceProfile::GARMIN_EDGE_830,
83
            1836 => DeviceProfile::GARMIN_EDGE_1000,
84
            2070 => DeviceProfile::GARMIN_EDGE_1000,
85
            2053 => DeviceProfile::GARMIN_EDGE_1000,
86
            2100 => DeviceProfile::GARMIN_EDGE_1000,
87
            2052 => DeviceProfile::GARMIN_EDGE_1000,
88
            2274 => DeviceProfile::GARMIN_EDGE_1000,
89
            2713 => DeviceProfile::GARMIN_EDGE_1030,
90
            3095 => DeviceProfile::GARMIN_EDGE_1030,
91
            2924 => DeviceProfile::GARMIN_EDGE_1030,
92
            1988 => DeviceProfile::GARMIN_EPIX,
93
            2332 => DeviceProfile::GARMIN_EPIX,
94
            2457 => DeviceProfile::GARMIN_EPIX,
95
            2140 => DeviceProfile::GARMIN_ETREX_TOUCH,
96
            1551 => DeviceProfile::GARMIN_FENIX,
97
            1967 => DeviceProfile::GARMIN_FENIX_2,
98
            2050 => DeviceProfile::GARMIN_FENIX_3,
99
            2188 => DeviceProfile::GARMIN_FENIX_3,
100
            2293 => DeviceProfile::GARMIN_FENIX_3,
101
            2407 => DeviceProfile::GARMIN_FENIX_3,
102
            2408 => DeviceProfile::GARMIN_FENIX_3,
103
            2189 => DeviceProfile::GARMIN_FENIX_3,
104
            2375 => DeviceProfile::GARMIN_FENIX_3,
105
            2432 => DeviceProfile::GARMIN_FENIX_3,
106
            2413 => DeviceProfile::GARMIN_FENIX_3_H_R,
107
            2473 => DeviceProfile::GARMIN_FENIX_3_H_R,
108
            2474 => DeviceProfile::GARMIN_FENIX_3_H_R,
109
            2475 => DeviceProfile::GARMIN_FENIX_3_H_R,
110
            2476 => DeviceProfile::GARMIN_FENIX_3_H_R,
111
            2477 => DeviceProfile::GARMIN_FENIX_3_H_R,
112
            2697 => DeviceProfile::GARMIN_FENIX_5,
113
            3110 => DeviceProfile::GARMIN_FENIX_5_PLUS,
114
            2796 => DeviceProfile::GARMIN_FENIX_5_WIFI,
115
            2797 => DeviceProfile::GARMIN_FENIX_5_S,
116
            2544 => DeviceProfile::GARMIN_FENIX_5_S,
117
            2604 => DeviceProfile::GARMIN_FENIX_5_X,
118
            2798 => DeviceProfile::GARMIN_FENIX_5_X,
119
            3089 => DeviceProfile::GARMIN_FENIX_5_X_PLUS,
120
            3135 => DeviceProfile::GARMIN_FENIX_5_X_PLUS,
121
            2900 => DeviceProfile::GARMIN_FENIX_5_S_PLUS,
122
            3134 => DeviceProfile::GARMIN_FENIX_5_S_PLUS,
123
            3111 => DeviceProfile::GARMIN_FENIX_5_X_PLUS,
124
            3112 => DeviceProfile::GARMIN_EDGE_520_PLUS,
125
            3142 => DeviceProfile::GARMIN_EDGE_520_PLUS,
126
            3287 => DeviceProfile::GARMIN_FENIX_6_S,
127
            3288 => DeviceProfile::GARMIN_FENIX_6_S_PRO,
128
            3289 => DeviceProfile::GARMIN_FENIX_6,
129
            3290 => DeviceProfile::GARMIN_FENIX_6_PRO,
130
            3291 => DeviceProfile::GARMIN_FENIX_6_X_PRO,
131
            3512 => DeviceProfile::GARMIN_FENIX_6_S,
132
            3513 => DeviceProfile::GARMIN_FENIX_6_S_PRO,
133
            3514 => DeviceProfile::GARMIN_FENIX_6,
134
            3515 => DeviceProfile::GARMIN_FENIX_6_PRO_SAPPHIRE,
135
            3516 => DeviceProfile::GARMIN_FENIX_6_X_SAPPHIRE,
136
            1482 => DeviceProfile::GARMIN_FORERUNNER_10,
137
            1688 => DeviceProfile::GARMIN_FORERUNNER_10,
138
            1903 => DeviceProfile::GARMIN_FORERUNNER_15,
139
            2061 => DeviceProfile::GARMIN_FORERUNNER_15,
140
            2148 => DeviceProfile::GARMIN_FORERUNNER_25,
141
            2891 => DeviceProfile::GARMIN_FORERUNNER_30,
142
            2977 => DeviceProfile::GARMIN_FORERUNNER_30,
143
            2503 => DeviceProfile::GARMIN_FORERUNNER_35,
144
            2650 => DeviceProfile::GARMIN_FORERUNNER_35,
145
            2667 => DeviceProfile::GARMIN_FORERUNNER_35,
146
            2668 => DeviceProfile::GARMIN_FORERUNNER_35,
147
            2814 => DeviceProfile::GARMIN_FORERUNNER_35,
148
            2727 => DeviceProfile::GARMIN_FORERUNNER_35,
149
            3469 => DeviceProfile::GARMIN_FORERUNNER_45,
150
            3282 => DeviceProfile::GARMIN_FORERUNNER_45_S,
151
            1436 => DeviceProfile::GARMIN_FORERUNNER_70,
152
            1124 => DeviceProfile::GARMIN_FORERUNNER_110,
153
            1274 => DeviceProfile::GARMIN_FORERUNNER_110,
154
            1360 => DeviceProfile::GARMIN_FORERUNNER_210,
155
            1632 => DeviceProfile::GARMIN_FORERUNNER_220,
156
            1631 => DeviceProfile::GARMIN_FORERUNNER_220,
157
            1931 => DeviceProfile::GARMIN_FORERUNNER_220,
158
            1930 => DeviceProfile::GARMIN_FORERUNNER_220,
159
            2073 => DeviceProfile::GARMIN_FORERUNNER_220,
160
            2174 => DeviceProfile::GARMIN_FORERUNNER_220,
161
            2153 => DeviceProfile::GARMIN_FORERUNNER_225,
162
            2219 => DeviceProfile::GARMIN_FORERUNNER_225,
163
            2313 => DeviceProfile::GARMIN_FORERUNNER_230,
164
            2157 => DeviceProfile::GARMIN_FORERUNNER_230,
165
            2431 => DeviceProfile::GARMIN_FORERUNNER_235,
166
            2396 => DeviceProfile::GARMIN_FORERUNNER_235,
167
            2733 => DeviceProfile::GARMIN_FORERUNNER_235,
168
            2397 => DeviceProfile::GARMIN_FORERUNNER_235,
169
            3144 => DeviceProfile::GARMIN_FORERUNNER_235,
170
            3076 => DeviceProfile::GARMIN_FORERUNNER_245,
171
            3145 => DeviceProfile::GARMIN_FORERUNNER_245,
172
            3321 => DeviceProfile::GARMIN_FORERUNNER_245_MUSIC,
173
            3077 => DeviceProfile::GARMIN_FORERUNNER_245_MUSIC,
174
            473 => DeviceProfile::GARMIN_FORERUNNER_301,
175
            474 => DeviceProfile::GARMIN_FORERUNNER_301,
176
            475 => DeviceProfile::GARMIN_FORERUNNER_301,
177
            494 => DeviceProfile::GARMIN_FORERUNNER_301,
178
            1018 => DeviceProfile::GARMIN_FORERUNNER_310_X_T,
179
            1446 => DeviceProfile::GARMIN_FORERUNNER_310_X_T,
180
            717 => DeviceProfile::GARMIN_FORERUNNER_405,
181
            987 => DeviceProfile::GARMIN_FORERUNNER_405,
182
            782 => DeviceProfile::GARMIN_FORERUNNER_50,
183
            988 => DeviceProfile::GARMIN_FORERUNNER_60,
184
            1345 => DeviceProfile::GARMIN_FORERUNNER_610,
185
            1410 => DeviceProfile::GARMIN_FORERUNNER_610,
186
            1623 => DeviceProfile::GARMIN_FORERUNNER_620,
187
            1929 => DeviceProfile::GARMIN_FORERUNNER_620,
188
            1928 => DeviceProfile::GARMIN_FORERUNNER_620,
189
            2072 => DeviceProfile::GARMIN_FORERUNNER_620,
190
            2173 => DeviceProfile::GARMIN_FORERUNNER_620,
191
            2156 => DeviceProfile::GARMIN_FORERUNNER_630,
192
            2310 => DeviceProfile::GARMIN_FORERUNNER_630,
193
            2311 => DeviceProfile::GARMIN_FORERUNNER_630,
194
            2886 => DeviceProfile::GARMIN_FORERUNNER_645,
195
            3003 => DeviceProfile::GARMIN_FORERUNNER_645,
196
            2888 => DeviceProfile::GARMIN_FORERUNNER_645_MUSIC,
197
            3004 => DeviceProfile::GARMIN_FORERUNNER_645_MUSIC,
198
            2158 => DeviceProfile::GARMIN_FORERUNNER_735_X_T,
199
            2533 => DeviceProfile::GARMIN_FORERUNNER_735_X_T,
200
            2534 => DeviceProfile::GARMIN_FORERUNNER_735_X_T,
201
            1328 => DeviceProfile::GARMIN_FORERUNNER_910_X_T,
202
            1537 => DeviceProfile::GARMIN_FORERUNNER_910_X_T,
203
            1600 => DeviceProfile::GARMIN_FORERUNNER_910_X_T,
204
            1664 => DeviceProfile::GARMIN_FORERUNNER_910_X_T,
205
            1765 => DeviceProfile::GARMIN_FORERUNNER_920_X_T,
206
            2131 => DeviceProfile::GARMIN_FORERUNNER_920_X_T,
207
            2132 => DeviceProfile::GARMIN_FORERUNNER_920_X_T,
208
            2130 => DeviceProfile::GARMIN_FORERUNNER_920_X_T,
209
            2691 => DeviceProfile::GARMIN_FORERUNNER_935,
210
            2833 => DeviceProfile::GARMIN_FORERUNNER_935,
211
            3113 => DeviceProfile::GARMIN_FORERUNNER_945,
212
            3441 => DeviceProfile::GARMIN_FORERUNNER_945,
213
            3498 => DeviceProfile::GARMIN_LEGACY_SAGA_REY,
214
            3499 => DeviceProfile::GARMIN_LEGACY_SAGA_DARTH_VADER,
215
            3420 => DeviceProfile::GARMIN_MARQ_DRIVER,
216
            3246 => DeviceProfile::GARMIN_MARQ_DRIVER,
217
            3421 => DeviceProfile::GARMIN_MARQ_AVIATOR,
218
            3247 => DeviceProfile::GARMIN_MARQ_AVIATOR,
219
            3248 => DeviceProfile::GARMIN_MARQ_CAPTAIN,
220
            3448 => DeviceProfile::GARMIN_MARQ_CAPTAIN,
221
            3249 => DeviceProfile::GARMIN_MARQ_COMMANDER,
222
            3449 => DeviceProfile::GARMIN_MARQ_COMMANDER,
223
            3250 => DeviceProfile::GARMIN_MARQ_ADVENTURER,
224
            3251 => DeviceProfile::GARMIN_MARQ_ATHLETE,
225
            3451 => DeviceProfile::GARMIN_MARQ_ATHLETE,
226
            3648 => DeviceProfile::GARMIN_MARQ_ADVENTURER,
227
            3624 => DeviceProfile::GARMIN_MARQ_ADVENTURER,
228
            3450 => DeviceProfile::GARMIN_MARQ_EXPEDITION,
229
            2512 => DeviceProfile::GARMIN_OREGON_700,
230
            1499 => DeviceProfile::GARMIN_SWIM,
231
            3405 => DeviceProfile::GARMIN_SWIM_2,
232
            3639 => DeviceProfile::GARMIN_SWIM_2,
233
            3226 => DeviceProfile::GARMIN_VENU,
234
            3737 => DeviceProfile::GARMIN_VENU_DAIMLER,
235
            3740 => DeviceProfile::GARMIN_VENU_DAIMLER,
236
            1907 => DeviceProfile::GARMIN_VIVO_ACTIVE,
237
            2160 => DeviceProfile::GARMIN_VIVO_ACTIVE,
238
            2337 => DeviceProfile::GARMIN_VIVO_ACTIVE_H_R,
239
            2497 => DeviceProfile::GARMIN_VIVO_ACTIVE_H_R,
240
            2976 => DeviceProfile::GARMIN_VIVO_ACTIVE_3,
241
            3473 => DeviceProfile::GARMIN_VIVO_ACTIVE_3,
242
            2700 => DeviceProfile::GARMIN_VIVO_ACTIVE_3,
243
            3446 => DeviceProfile::GARMIN_VIVO_ACTIVE_3,
244
            2988 => DeviceProfile::GARMIN_VIVO_ACTIVE_3_MUSIC,
245
            3163 => DeviceProfile::GARMIN_VIVO_ACTIVE_3_MUSIC,
246
            3066 => DeviceProfile::GARMIN_VIVO_ACTIVE_3_MUSIC,
247
            3225 => DeviceProfile::GARMIN_VIVO_ACTIVE_4,
248
            3388 => DeviceProfile::GARMIN_VIVO_ACTIVE_4,
249
            3389 => DeviceProfile::GARMIN_VIVO_ACTIVE_4,
250
            3224 => DeviceProfile::GARMIN_VIVO_ACTIVE_4_S,
251
            3387 => DeviceProfile::GARMIN_VIVO_ACTIVE_4_S,
252
            1837 => DeviceProfile::GARMIN_VIVO_FIT,
253
            2606 => DeviceProfile::GARMIN_VIVO_FIT_JR,
254
            2150 => DeviceProfile::GARMIN_VIVO_FIT_2,
255
            2406 => DeviceProfile::GARMIN_VIVO_FIT_3,
256
            2368 => DeviceProfile::GARMIN_VIVO_MOVE,
257
            3422 => DeviceProfile::GARMIN_VIVO_MOVE_3,
258
            2772 => DeviceProfile::GARMIN_VIVO_MOVE_H_R,
259
            2945 => DeviceProfile::GARMIN_VIVO_MOVE_H_R,
260
            3378 => DeviceProfile::GARMIN_VIVO_MOVE_3_S,
261
            3308 => DeviceProfile::GARMIN_VIVO_MOVE_LUXE,
262
            2623 => DeviceProfile::GARMIN_VIVO_SPORT,
263
            2832 => DeviceProfile::GARMIN_VIVO_SPORT,
264
            1956 => DeviceProfile::GARMIN_VIVO_SMART,
265
            2135 => DeviceProfile::GARMIN_VIVO_SMART,
266
            2294 => DeviceProfile::GARMIN_VIVO_SMART,
267
            2271 => DeviceProfile::GARMIN_VIVO_SMART_2,
268
            2831 => DeviceProfile::GARMIN_VIVO_SMART_3,
269
            2622 => DeviceProfile::GARMIN_VIVO_SMART_3,
270
            2927 => DeviceProfile::GARMIN_VIVO_SMART_4,
271
            3218 => DeviceProfile::GARMIN_VIVO_SMART_4,
272
            2347 => DeviceProfile::GARMIN_VIVO_SMART_GPS_H_R,
273
            2362 => DeviceProfile::GARMIN_VIVO_SMART_GPS_H_R,
274
            2348 => DeviceProfile::GARMIN_VIVO_SMART_H_R,
275
            2361 => DeviceProfile::GARMIN_VIVO_SMART_H_R,
276
            3273 => DeviceProfile::GARMIN_INSTINCT,
277
            3192 => DeviceProfile::GARMIN_SPEED_SENSOR_2,
278
            1438 => DeviceProfile::GARMIN_FIT_ANDROID,
279
            1439 => DeviceProfile::GARMIN_FIT_IPHONE,
280
        ];
281
    }
282
283
    public function __construct()
284
    {
285
        $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...
286
    }
287
288
    /**
289
     * @param  int|string $value
290
     * @return int|string
291
     */
292
    public function toInternal($value)
293
    {
294
        if (isset($this->Mapping[$value])) {
295
            return $this->Mapping[$value];
296
        }
297
298
        return;
299
    }
300
}
301