Completed
Pull Request — master (#3)
by Michael
01:18
created

SuuntoFitSdkMapping::getMapping()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 44

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 44
c 0
b 0
f 0
ccs 0
cts 44
cp 0
rs 9.216
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 SuuntoFitSdkMapping
17
{
18
    /** @var int[]|string[] */
19
    protected $Mapping = [];
20
21
    protected function getMapping()
22
    {
23
        return [
24
            1 => DeviceProfile::SUUNTO_X_9,
25
            2 => DeviceProfile::SUUNTO_X_10,
26
            3 => DeviceProfile::SUUNTO_X_6,
27
            4 => DeviceProfile::SUUNTO_MEMORY_BELT,
28
            5 => DeviceProfile::SUUNTO_SMART_BELT,
29
            6 => DeviceProfile::SUUNTO_T_6,
30
            7 => DeviceProfile::SUUNTO_T_6_C,
31
            8 => DeviceProfile::SUUNTO_T_6_D,
32
            9 => DeviceProfile::SUUNTO_T_4,
33
            10 => DeviceProfile::SUUNTO_T_4_C,
34
            11 => DeviceProfile::SUUNTO_T_4_D,
35
            12 => DeviceProfile::SUUNTO_T_3,
36
            13 => DeviceProfile::SUUNTO_T_3_C,
37
            14 => DeviceProfile::SUUNTO_T_3_D,
38
            15 => DeviceProfile::SUUNTO_M_4,
39
            16 => DeviceProfile::SUUNTO_M_5,
40
            17 => DeviceProfile::SUUNTO_QUEST,
41
            18 => DeviceProfile::SUUNTO_AMBIT,
42
            19 => DeviceProfile::SUUNTO_AMBIT_2,
43
            20 => DeviceProfile::SUUNTO_AMBIT_2_S,
44
            21 => DeviceProfile::SUUNTO_AMBIT_2_R,
45
            22 => DeviceProfile::SUUNTO_AMBIT_3_PEAK,
46
            23 => DeviceProfile::SUUNTO_AMBIT_3_SPORT,
47
            24 => DeviceProfile::SUUNTO_AMBIT_3_RUN,
48
            25 => DeviceProfile::SUUNTO_AMBIT_3_VERTICAL,
49
            26 => DeviceProfile::SUUNTO_TRAVERSE,
50
            27 => DeviceProfile::SUUNTO_TRAVERSE_ALPHA,
51
            28 => DeviceProfile::SUUNTO_SPARTAN_SPORT,
52
            29 => DeviceProfile::SUUNTO_SPARTAN_ULTRA,
53
            30 => DeviceProfile::SUUNTO_SPARTAN_SPORT_WRIST_HR,
54
            31 => DeviceProfile::SUUNTO_SPARTAN_TRAINER_WRIST_HR,
55
            32 => DeviceProfile::SUUNTO_SPARTAN_SPORT_WRIST_HR_BARO,
56
            33 => DeviceProfile::SUUNTO_3_FITNESS,
57
            34 => DeviceProfile::SUUNTO_9_BARO,
58
            35 => DeviceProfile::SUUNTO_9,
59
            36 => DeviceProfile::SUUNTO_5,
60
            37 => DeviceProfile::SUUNTO_EON_CORE,
61
            38 => DeviceProfile::SUUNTO_EON_STEEL,
62
            39 => DeviceProfile::SUUNTO_D_5,
63
        ];
64
    }
65
66
    public function __construct()
67
    {
68
        $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...
69
    }
70
71
    /**
72
     * @param  int|string $value
73
     * @return int|string
74
     */
75
    public function toInternal($value)
76
    {
77
        if (isset($this->Mapping[$value])) {
78
            return $this->Mapping[$value];
79
        }
80
81
        return;
82
    }
83
}
84