PDepend\Metrics\Analyzer\InheritanceAnalyzer::calculateDepthOfInheritanceTree PHP Method

calculateDepthOfInheritanceTree() private method

Calculates the maximum HIT for the given class.
Since: 0.9.10
private calculateDepthOfInheritanceTree ( PDepend\Source\AST\ASTClass $class ) : void
$class PDepend\Source\AST\ASTClass
return void
    private function calculateDepthOfInheritanceTree(ASTClass $class)
    {
        $dit = 0;
        $id = $class->getId();
        $root = $class->getId();
        foreach ($class->getParentClasses() as $parent) {
            if (!$parent->isUserDefined()) {
                ++$dit;
            }
            ++$dit;
            $root = $parent->getId();
        }
        // Collect max dit value
        $this->maxDIT = max($this->maxDIT, $dit);
        if (empty($this->rootClasses[$root]) || $this->rootClasses[$root] < $dit) {
            $this->rootClasses[$root] = $dit;
        }
        $this->nodeMetrics[$id][self::M_DEPTH_OF_INHERITANCE_TREE] = $dit;
    }