SigmaSportFitSdkMapping   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 37
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMapping() 0 13 1
A __construct() 0 4 1
A toInternal() 0 8 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 SigmaSportFitSdkMapping
17
{
18
    /** @var int[]|string[] */
19
    protected $Mapping = [];
20
21
    protected function getMapping()
22
    {
23
        return [
24
            46 => DeviceProfile::SIGMA_SPORT_ID_TRI,
25
            44 => DeviceProfile::SIGMA_SPORT_ROX_120_SPORT,
26
            41 => DeviceProfile::SIGMA_SPORT_ROX_110_GPS,
27
            15 => DeviceProfile::SIGMA_SPORT_ROX_100_GPS,
28
        ];
29
        /*
30
         * Unknown:
31
         * 46
32
         */
33
    }
34
35
    public function __construct()
36
    {
37
        $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...
38
    }
39
40
    /**
41
     * @param  int|string $value
42
     * @return int|string
43
     */
44
    public function toInternal($value)
45
    {
46
        if (isset($this->Mapping[$value])) {
47
            return $this->Mapping[$value];
48
        }
49
50
        return;
51
    }
52
}
53