Completed
Push — master ( ca080c...0b7085 )
by Michael
01:14
created

FitMapping   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 5
dl 0
loc 58
ccs 0
cts 45
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
B guessDevice() 0 20 6
A getGarminDevice() 0 6 1
A getCorosDevice() 0 6 1
A getSuuntoDevice() 0 6 1
A getWahooDevice() 0 6 1
A getOsynceDevice() 0 6 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
class FitMapping
15
{
16
    public static function guessDevice($manufactorId, $productId)
17
    {
18
        switch ($manufactorId) {
19
            case 1:
20
                return self::getGarminDevice($productId);
21
                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...
22
            case 23:
23
                return self::getSuuntoDevice($productId);
24
                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...
25
            case 294:
26
                return self::getCorosDevice($productId);
27
                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...
28
            case 32:
29
                return self::getWahooDevice($productId);
30
            case 38:
31
                return self::getOsynceDevice($productId);
32
            default:
33
                return null;
34
        }
35
    }
36
37
    public function getGarminDevice($productId)
38
    {
39
        $garmin = new GarminFitSdkMapping();
40
41
        return $garmin->toInternal($productId);
42
    }
43
44
    public function getCorosDevice($productId)
45
    {
46
        $coros = new CorosFitSdkMapping();
47
48
        return $coros->toInternal($productId);
49
    }
50
51
    public function getSuuntoDevice($productId)
52
    {
53
        $suunto = new SuuntoFitSdkMapping();
54
55
        return $suunto->toInternal($productId);
56
    }
57
58
    public function getWahooDevice($productId)
59
    {
60
        $wahoo = new WahooFitSdkMapping();
61
62
        return $wahoo->toInternal($productId);
63
    }
64
65
    public function getOsynceDevice($productId)
66
    {
67
        $osynce = new OsynceFitSdkMapping();
68
69
        return $osynce->toInternal($productId);
70
    }
71
}
72