Completed
Push — master ( e1173d...cdf0e4 )
by Oskar
05:16 queued 03:02
created

PackageDistance::calculate()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 4
c 0
b 0
f 0
nc 3
nop 1
dl 0
loc 8
rs 8.8571
1
<?php
2
declare(strict_types=1);
3
namespace Hal\Metric\Package;
4
5
use Hal\Metric\Metrics;
6
use Hal\Metric\PackageMetric;
7
8
class PackageDistance
9
{
10
    public function calculate(Metrics $metrics)
11
    {
12
        foreach ($metrics->all() as $each) {
13
            if ($each instanceof PackageMetric && $each->getAbstraction() !== null && $each->getInstability() !== null) {
14
                $each->setNormalizedDistance(abs($each->getAbstraction() + $each->getInstability() - 1));
15
            }
16
        }
17
    }
18
}
19