/** * Calculates the Variables Inheritance of a class metric, this method only * counts protected and public properties of parent classes. * * @param \PDepend\Source\AST\ASTClass $class The context class instance. * @return integer */ private function calculateVarsi(ASTClass $class) { // List of properties, this method only counts not overwritten properties $properties = array(); // Collect all properties of the context class foreach ($class->getProperties() as $prop) { $properties[$prop->getName()] = true; } foreach ($class->getParentClasses() as $parent) { foreach ($parent->getProperties() as $prop) { if (!$prop->isPrivate() && !isset($properties[$prop->getName()])) { $properties[$prop->getName()] = true; } } } return count($properties); }