SuuntoFitSdkMapping::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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