PDepend\Report\Overview\Pyramid::computeProportions PHP Method

computeProportions() private method

Computes the proportions between the given metrics.
private computeProportions ( array $metrics ) : array(string
$metrics array The aggregated project metrics.
return array(string
    private function computeProportions(array $metrics)
    {
        $orders = array(array('cyclo', 'loc', 'nom', 'noc', 'nop'), array('fanout', 'calls', 'nom'));
        $proportions = array();
        foreach ($orders as $names) {
            for ($i = 1, $c = count($names); $i < $c; ++$i) {
                $value1 = $metrics[$names[$i]];
                $value2 = $metrics[$names[$i - 1]];
                $identifier = "{$names[$i - 1]}-{$names[$i]}";
                $proportions[$identifier] = 0;
                if ($value1 > 0) {
                    $proportions[$identifier] = round($value2 / $value1, 3);
                }
            }
        }
        return $proportions;
    }