Component   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A version() 0 11 2
1
<?php
2
3
namespace BootPress\Bootstrap;
4
5
class Component
6
{
7 31
    public static function version($number)
8
    {
9 31
        $version = (int) substr($number, 0, 1);
10
        switch ($version) {
11 31
            case 3:
12 30
                return new Bootstrap3($number);
13
            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...
14 1
            default:
15 1
                throw new \Exception("Bootstrap version {$version} is not currently supported.");
16 1
        }
17
    }
18
}
19