Test Failed
Branch feature__set_up_scrutinizer (ea6624)
by Robin
06:04 queued 02:46
created

ChooseMechanic   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 11
dl 0
loc 24
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A forOS() 0 16 5
1
<?php
2
3
namespace App\Support\Mechanics;
4
5
class ChooseMechanic
6
{
7
    /**
8
     * Get the mechanic for the host operating system.
9
     *
10
     * @param string|null $os
11
     * @return Mechanic
12
     */
13 50
    public static function forOS($os = null)
14
    {
15 50
        $os = $os ?: PHP_OS;
16
17
        switch (true) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing stristr($os, 'WIN') of type string to the boolean true. If you are specifically checking for a non-empty string, consider using the more explicit !== '' instead.
Loading history...
Bug Best Practice introduced by
It seems like you are loosely comparing stristr($os, 'LINUX') of type string to the boolean true. If you are specifically checking for a non-empty string, consider using the more explicit !== '' instead.
Loading history...
Bug Best Practice introduced by
It seems like you are loosely comparing stristr($os, 'DAR') of type string to the boolean true. If you are specifically checking for a non-empty string, consider using the more explicit !== '' instead.
Loading history...
18 50
            case stristr($os, 'DAR'):
19 1
                return app(MacOs::class);
20
21 50
            case stristr($os, 'WIN'):
22 1
                return app(Windows::class);
23
24 50
            case stristr($os, 'LINUX'):
25 50
                return app(Linux::class);
26
27
            default :
28 1
                return app(Untrained::class);
29
        }
30
    }
31
}
32