Completed
Pull Request — master (#5)
by Michael
01:03
created

DevelopmentFitSdkMapping::__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
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
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 DevelopmentFitSdkMapping
17
{
18
    /** @var int[]|string[] */
19
    protected $Mapping = [];
20
21
    protected function getMapping()
22
    {
23
        return [
24
            'Watch1,1'  => DeviceProfile::APPLE_WATCH_V_38,
25
            'Watch1,2'  => DeviceProfile::APPLE_WATCH_V_42,
26
            'Watch2,6'  => DeviceProfile::APPLE_WATCH_1_V_38,
27
            'Watch2,7'  => DeviceProfile::APPLE_WATCH_1_V_42,
28
            'Watch2,3'  => DeviceProfile::APPLE_WATCH_2_V_38,
29
            'Watch2,4'  => DeviceProfile::APPLE_WATCH_2_V_42,
30
            'Watch3,1'  => DeviceProfile::APPLE_WATCH_3_V_38_CELLULAR,
31
            'Watch3,2'  => DeviceProfile::APPLE_WATCH_3_V_42_CELLULAR,
32
            'Watch3,3'  => DeviceProfile::APPLE_WATCH_3_V_38,
33
            'Watch3,4'  => DeviceProfile::APPLE_WATCH_3_V_42,
34
            'Watch4,1'  => DeviceProfile::APPLE_WATCH_4_V_40,
35
            'Watch4,2'  => DeviceProfile::APPLE_WATCH_4_V_44,
36
            'Watch4,3'  => DeviceProfile::APPLE_WATCH_4_V_40_CELLULAR,
37
            'Watch4,4'  => DeviceProfile::APPLE_WATCH_4_V_44_CELLULAR,
38
            'Watch5,1'  => DeviceProfile::APPLE_WATCH_5_V_40,
39
            'Watch5,2'  => DeviceProfile::APPLE_WATCH_5_V_44,
40
            'Watch5,3'  => DeviceProfile::APPLE_WATCH_5_V_40_CELLULAR,
41
            'Watch5,4'  => DeviceProfile::APPLE_WATCH_5_V_44_CELLULAR,
42
        ];
43
    }
44
45
    public function __construct()
46
    {
47
        $this->Mapping = $this->getMapping();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMapping() of type array<string,?> 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...
48
    }
49
50
    /**
51
     * @param  int|string $value
52
     * @return int|string
53
     */
54
    public function toInternal($value)
55
    {
56
        if (isset($this->Mapping[$value])) {
57
            return $this->Mapping[$value];
58
        }
59
60
        return;
61
    }
62
}
63