Completed
Push — master ( 486315...705061 )
by Michael
01:25
created

FitMapping   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 3
dl 0
loc 36
ccs 0
cts 27
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A guessDevice() 0 16 4
A getGarminDevice() 0 4 1
A getCorosDevice() 0 4 1
A getSuuntoDevice() 0 4 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 FitMapping
17
{
18
    public static function guessDevice($manufactorId, $productId) {
19
20
        switch ($manufactorId) {
21
            case 1:
22
                return self::getGarminDevice($productId);
23
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
24
            case 23:
25
                return self::getSuuntoDevice($productId);
26
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
27
            case 294:
28
                return self::getCorosDevice($productId);
29
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
30
            default:
31
                return null;
32
        }
33
    }
34
35
    public function getGarminDevice($productId) {
36
        $garmin = new GarminFitSdkMapping();
37
        return $garmin->toInternal($productId);
38
    }
39
40
    public function getCorosDevice($productId) {
41
        $coros = new CorosFitSdkMapping();
42
        return $coros->toInternal($productId);
43
    }
44
45
    public function getSuuntoDevice($productId) {
46
        $suunto = new SuuntoFitSdkMapping();
47
        return $suunto->toInternal($productId);
48
    }
49
50
51
}
52