StateManager::getLineState()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 0
cts 11
cp 0
rs 9.8666
c 0
b 0
f 0
cc 4
nc 4
nop 1
crap 20
1
<?php
2
3
/**
4
 * This file is part of the Clover to Html package.
5
 *
6
 * (c) Stéphane Demonchaux <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace CloverToHtml;
12
13
class StateManager
14
{
15
    public function getLineState(StatsInterface $stats):? string
16
    {
17
        $percent = $stats->getLineCoveredPercent();
18
19
        if ($percent > 70) {
20
            return 'green';
21
        } elseif ($percent > 50) {
22
            return 'warning';
23
        } elseif ($percent > 40) {
24
            return 'danger';
25
        }
26
    }
27
}
28