PDepend\Metrics\Analyzer\DependencyAnalyzer::calculateInstability PHP Method

calculateInstability() protected method

Calculates the instability for all analyzed nodes.
protected calculateInstability ( ) : void
return void
    protected function calculateInstability()
    {
        foreach ($this->nodeMetrics as $id => $metrics) {
            // Count total incoming and outgoing dependencies
            $total = $metrics[self::M_AFFERENT_COUPLING] + $metrics[self::M_EFFERENT_COUPLING];
            if ($total !== 0) {
                $this->nodeMetrics[$id][self::M_INSTABILITY] = $metrics[self::M_EFFERENT_COUPLING] / $total;
            }
        }
    }