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 NameMapping |
17
|
|
|
{ |
18
|
|
|
/** @var int[]|string[] */ |
19
|
|
|
protected $Mapping = []; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @return array |
23
|
|
|
*/ |
24
|
1 |
|
protected function getMapping() |
25
|
|
|
{ |
26
|
|
|
return [ |
27
|
1 |
|
'neorun' => DeviceProfile::APP_EPSON_NEO_RUN, |
28
|
|
|
'kompass' => DeviceProfile::APP_KOMPASS, |
29
|
|
|
'runtastic' => DeviceProfile::APP_RUNTASTIC, |
30
|
|
|
'smashrun' => DeviceProfile::APP_SMASHRUN, |
31
|
|
|
'trails' => DeviceProfile::APP_TRAILS, |
32
|
|
|
'sports tracker' => DeviceProfile::APP_SPORTS_TRACKER, |
33
|
|
|
'runkeeper' => DeviceProfile::APP_RUNKEEPER, |
34
|
|
|
'runmeter' => DeviceProfile::APP_RUNMETER, |
35
|
|
|
'decathlon' => DeviceProfile::APP_DECATHLON_COACH, |
36
|
|
|
'endomondo' => DeviceProfile::APP_ENDOMONDO, |
37
|
|
|
'ismoothrun' => DeviceProfile::APP_I_SMOOTH_RUN, |
38
|
|
|
'strava' => DeviceProfile::APP_STRAVA, |
39
|
|
|
'trailrunner' => DeviceProfile::APP_TRAIL_RUNNER, |
40
|
|
|
'run.gps' => DeviceProfile::APP_RUN_GPS_TRAINER, |
41
|
|
|
'osmand' => DeviceProfile::APP_OSM_AND, |
42
|
|
|
'locus map' => DeviceProfile::APP_LOCUS_MAP, |
43
|
|
|
'endomondo' => DeviceProfile::APP_ENDOMONDO, |
44
|
|
|
'runnerup' => DeviceProfile::APP_RUNNERUP, |
45
|
|
|
'polar flow' => DeviceProfile::APP_POLAR_FLOW, |
46
|
|
|
'sportractive' => DeviceProfile::APP_SPORTRACTIVE, |
47
|
|
|
'oruxmaps' => DeviceProfile::APP_ORUX_MAPS, |
48
|
|
|
'komoot' => DeviceProfile::APP_KOMOOT, |
49
|
|
|
'navime' => DeviceProfile::APP_NAVIME, |
50
|
|
|
'http://www.polarpersonaltrainer.com' => DeviceProfile::APP_POLAR_PERSONAL_TRAINER, |
51
|
|
|
'a-rival' => DeviceProfile::ARIVAL_UNKNOWN, |
52
|
|
|
'rungap' => DeviceProfile::APP_RUN_GAP, |
53
|
|
|
'globalsat' => DeviceProfile::APP_GLOBAL_SAT, |
54
|
|
|
'the sufferfest training system' => DeviceProfile::APP_THE_SUFFERFEST, |
55
|
|
|
'garmin connect' => DeviceProfile::APP_GARMIN_CONNECT, |
56
|
|
|
'outdooractive' => DeviceProfile::APP_OUTDOOR_ACTIVE, |
57
|
|
|
'etrex 30x' => DeviceProfile::GARMIN_ETREX_30_X, |
58
|
|
|
'polar vantage m' => DeviceProfile::POLAR_VANTAGE_M, |
59
|
|
|
'polar vantage v2' => DeviceProfile::POLAR_VANTAGE_V_2, |
60
|
|
|
'polar vantage v' => DeviceProfile::POLAR_VANTAGE_V, |
61
|
|
|
'polar a370' => DeviceProfile::POLAR_A_370, |
62
|
|
|
'polar m200' => DeviceProfile::POLAR_M_200, |
63
|
|
|
'polar m400' => DeviceProfile::POLAR_M_400, |
64
|
|
|
'polar m430' => DeviceProfile::POLAR_M_430, |
65
|
|
|
'polar m450' => DeviceProfile::POLAR_M_450, |
66
|
|
|
'polar m460' => DeviceProfile::POLAR_M_460, |
67
|
|
|
'polar m600' => DeviceProfile::POLAR_M_600, |
68
|
|
|
'polar v650' => DeviceProfile::POLAR_V_650, |
69
|
|
|
'polar v800' => DeviceProfile::POLAR_V_800, |
70
|
|
|
'polar ignite' => DeviceProfile::POLAR_IGNITE, |
71
|
|
|
'polar grit x' => DeviceProfile::POLAR_GRIT_X, |
72
|
|
|
'fitbit ionic' => DeviceProfile::FITBIT_IONIC, |
73
|
|
|
'fitbit surge' => DeviceProfile::FITBIT_SURGE, |
74
|
|
|
'fitbit versa' => DeviceProfile::FITBIT_VERSA, |
75
|
|
|
'fitbit charge 2' => DeviceProfile::FITBIT_CHARGE_2, |
76
|
|
|
'fēnix 3' => DeviceProfile::GARMIN_FENIX_3, |
77
|
|
|
'fēnix 3 hr' => DeviceProfile::GARMIN_FENIX_3_H_R, |
78
|
|
|
'forerunner 235' => DeviceProfile::GARMIN_FORERUNNER_235, |
79
|
|
|
'forereunner305' => DeviceProfile::GARMIN_FORERUNNER_305, |
80
|
|
|
'forereunner 310xt' => DeviceProfile::GARMIN_FORERUNNER_310_X_T, |
81
|
|
|
'forereunner 405' => DeviceProfile::GARMIN_FORERUNNER_405, |
82
|
|
|
'forereunner 410' => DeviceProfile::GARMIN_FORERUNNER_410, |
83
|
|
|
'forereunner 735xt' => DeviceProfile::GARMIN_FORERUNNER_735_X_T, |
84
|
|
|
'forereunner 935' => DeviceProfile::GARMIN_FORERUNNER_935, |
85
|
|
|
'forereunner 945' => DeviceProfile::GARMIN_FORERUNNER_945, |
86
|
|
|
'fenix 6 sapphire' => DeviceProfile::GARMIN_FENIX_6, |
87
|
|
|
'garmin forereunner 610' => DeviceProfile::GARMIN_FORERUNNER_610, |
88
|
|
|
'garmin forerunner 245' => DeviceProfile::GARMIN_FORERUNNER_245, |
89
|
|
|
'garmin forerunner 735xt' => DeviceProfile::GARMIN_FORERUNNER_735_X_T, |
90
|
1 |
|
'garmin forerunner 935' => DeviceProfile::GARMIN_FORERUNNER_935, |
91
|
|
|
'garmin venu sq' => DeviceProfile::GARMIN_VENU_SQ, |
92
|
1 |
|
'fr15' => DeviceProfile::GARMIN_FORERUNNER_15, |
93
|
1 |
|
'oregon 600' => DeviceProfile::GARMIN_OREGON_600, |
94
|
|
|
'oregon 700' => DeviceProfile::GARMIN_OREGON_700, |
95
|
|
|
'suunto ambit2' => DeviceProfile::SUUNTO_AMBIT_2, |
96
|
|
|
'suunto ambit2 r' => DeviceProfile::SUUNTO_AMBIT_2_R, |
97
|
|
|
'suunto ambit2 s' => DeviceProfile::SUUNTO_AMBIT_2_S, |
98
|
|
|
'relive' => DeviceProfile::APP_RELIVE, |
99
|
1 |
|
'gpsmap 64s' => DeviceProfile::GARMIN_GPSMAP_64_S, |
100
|
|
|
'gpsmap 64st' => DeviceProfile::GARMIN_GPSMAP_64_S_T, |
101
|
1 |
|
'gpsmap 65s' => DeviceProfile::GARMIN_GPSMAP_65_S, |
102
|
1 |
|
'gpsmap 66i' => DeviceProfile::GARMIN_GPSMAP_66_I, |
103
|
1 |
|
'gpsmap 66S' => DeviceProfile::GARMIN_GPSMAP_66_S, |
104
|
|
|
'gpsmap 66sr' => DeviceProfile::GARMIN_GPSMAP_66_S_R, |
105
|
|
|
'gpsmap66' => DeviceProfile::GARMIN_GPSMAP_66, |
106
|
|
|
'huami amazfit pace' => DeviceProfile::HUAMI_AMAZFIT_PACE, |
107
|
1 |
|
'etrex 30' => DeviceProfile::GARMIN_ETREX_30, |
108
|
|
|
'etrex 30x' => DeviceProfile::GARMIN_ETREX_30_X, |
109
|
|
|
'epix' => DeviceProfile::GARMIN_EPIX, |
110
|
|
|
'bkool' => DeviceProfile::APP_BKOOL, |
111
|
|
|
'coros wearables' => DeviceProfile::COROS_UNKNOWN, |
112
|
|
|
'bryton' => DeviceProfile::BRYTON_UNKNOWN, |
113
|
|
|
'suunto ambit3 peak' => DeviceProfile::SUUNTO_AMBIT_3_PEAK, |
114
|
|
|
'stryd' => DeviceProfile::STRYD_UNKNOWN, |
115
|
|
|
'ghostracer' => DeviceProfile::APP_GHOSTRACER, |
116
|
|
|
]; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function __construct() |
120
|
|
|
{ |
121
|
|
|
$this->Mapping = $this->getMapping(); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @param int|string $creator |
126
|
|
|
* @return int|string |
127
|
|
|
*/ |
128
|
|
|
public function toInternal($creator) |
129
|
|
|
{ |
130
|
|
|
foreach ($this->Mapping as $startsWith => $id) { |
131
|
|
|
if (strtolower(substr($creator, 0, strlen($startsWith))) === $startsWith) { |
|
|
|
|
132
|
|
|
return $id; |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
return; |
137
|
|
|
} |
138
|
|
|
} |
139
|
|
|
|