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

FitMapping::getSuuntoDevice()   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 1
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 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