|
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
|
|
|
'polar flow' => DeviceProfile::APP_POLAR_FLOW, |
|
45
|
|
|
'sportractive' => DeviceProfile::APP_SPORTRACTIVE, |
|
46
|
|
|
'oruxmaps' => DeviceProfile::APP_ORUX_MAPS, |
|
47
|
|
|
'komoot' => DeviceProfile::APP_KOMOOT, |
|
48
|
|
|
'navime' => DeviceProfile::APP_NAVIME, |
|
49
|
|
|
'http://www.polarpersonaltrainer.com' => DeviceProfile::APP_POLAR_PERSONAL_TRAINER, |
|
50
|
|
|
'a-rival' => DeviceProfile::ARIVAL_UNKNOWN, |
|
51
|
|
|
'rungap' => DeviceProfile::APP_RUN_GAP, |
|
52
|
|
|
'globalsat' => DeviceProfile::APP_GLOBAL_SAT, |
|
53
|
|
|
'garmin connect' => DeviceProfile::APP_GARMIN_CONNECT, |
|
54
|
|
|
'outdooractive' => DeviceProfile::APP_OUTDOOR_ACTIVE, |
|
55
|
|
|
'Polar Vantage M' => DeviceProfile::POLAR_VANTAGE_M, |
|
56
|
|
|
'Polar Vantage V' => DeviceProfile::POLAR_VANTAGE_M, |
|
57
|
|
|
'Polar A370' => DeviceProfile::POLAR_A_370, |
|
58
|
|
|
'Polar M200' => DeviceProfile::POLAR_M_400, |
|
59
|
|
|
'Polar M400' => DeviceProfile::POLAR_M_400, |
|
60
|
|
|
'Polar M430' => DeviceProfile::POLAR_M_430, |
|
61
|
|
|
'Polar M450' => DeviceProfile::POLAR_M_450, |
|
62
|
|
|
'Polar M460' => DeviceProfile::POLAR_M_460, |
|
63
|
|
|
'Polar M600' => DeviceProfile::POLAR_M_600, |
|
64
|
|
|
'Polar V650' => DeviceProfile::POLAR_V_650, |
|
65
|
|
|
'Polar V800' => DeviceProfile::POLAR_V_800, |
|
66
|
|
|
'Polar Ignite' => DeviceProfile::POLAR_IGNITE, |
|
67
|
|
|
'Fitbit Ionic' => DeviceProfile::FITBIT_IONIC, |
|
68
|
|
|
'Fitbit Surge' => DeviceProfile::FITBIT_SURGE, |
|
69
|
|
|
'Fitbit Versa' => DeviceProfile::FITBIT_VERSA, |
|
70
|
|
|
'Fitbit Charge 2' => DeviceProfile::FITBIT_CHARGE_2, |
|
71
|
|
|
'fēnix 3' => DeviceProfile::GARMIN_FENIX_3, |
|
72
|
|
|
'fēnix 3 HR' => DeviceProfile::GARMIN_FENIX_3_H_R, |
|
73
|
|
|
'Forerunner 235' => DeviceProfile::GARMIN_FORERUNNER_235, |
|
74
|
|
|
'Forerunner305' => DeviceProfile::GARMIN_FORERUNNER_305, |
|
75
|
|
|
'Forerunner 310XT' => DeviceProfile::GARMIN_FORERUNNER_310_X_T, |
|
76
|
|
|
'Forerunner 405' => DeviceProfile::GARMIN_FORERUNNER_405, |
|
77
|
|
|
'Forerunner 410' => DeviceProfile::GARMIN_FORERUNNER_410, |
|
78
|
|
|
'Forerunner 735XT' => DeviceProfile::GARMIN_FORERUNNER_735_X_T, |
|
79
|
|
|
'Forerunner 935' => DeviceProfile::GARMIN_FORERUNNER_935, |
|
80
|
|
|
'Forerunner 945' => DeviceProfile::GARMIN_FORERUNNER_945, |
|
81
|
|
|
'Garmin Forerunner 610' => DeviceProfile::GARMIN_FORERUNNER_610, |
|
82
|
|
|
'Suunto Ambit2' => DeviceProfile::SUUNTO_AMBIT_2, |
|
83
|
|
|
'Suunto Ambit2 R' => DeviceProfile::SUUNTO_AMBIT_2_R, |
|
84
|
|
|
'Suunto Ambit2 S' => DeviceProfile::SUUNTO_AMBIT_2_S, |
|
85
|
|
|
]; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
1 |
|
public function __construct() |
|
89
|
|
|
{ |
|
90
|
1 |
|
$this->Mapping = $this->getMapping(); |
|
91
|
1 |
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @param int|string $creator |
|
95
|
|
|
* @return int|string |
|
96
|
|
|
*/ |
|
97
|
1 |
|
public function toInternal($creator) |
|
98
|
|
|
{ |
|
99
|
1 |
|
foreach ($this->Mapping as $startsWith => $id) { |
|
100
|
1 |
|
if (strtolower(substr($creator, 0, strlen($startsWith))) === $startsWith) { |
|
|
|
|
|
|
101
|
1 |
|
return $id; |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
1 |
|
return; |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|