Neos.ContentRepository/Classes/Domain/Model/NodeType.php
protected function traverseSuperTypes(NodeType $currentNodeType, $constraintNodeTypeName, $distance)
    {
        if ($currentNodeType->getName() === $constraintNodeTypeName) {
            return $distance;
        }

        $distance++;
        foreach ($currentNodeType->getDeclaredSuperTypes() as $superType) {
            $result = $this->traverseSuperTypes($superType, $constraintNodeTypeName, $distance);
            if ($result !== null) {
                return $result;
            }
        }

        return null;
    }
protected function traverseSuperTypes(NodeType $currentNodeType, $constraintNodeTypeName, $distance)
    {
        if ($currentNodeType->getName() === $constraintNodeTypeName) {
            return $distance;
        }

        $distance++;
        foreach ($currentNodeType->getDeclaredSuperTypes() as $superType) {
            $result = $this->traverseSuperTypes($superType, $constraintNodeTypeName, $distance);
            if ($result !== null) {
                return $result;
            }
        }

        return null;
    }
protected function traverseSuperTypes ( NodeType $ currentNodeType , $ constraintNodeTypeName , $ distance ) { if ( $ currentNodeType -> getName ( ) === $ constraintNodeTypeName ) { return $ distance ; } $ distance ++ ; foreach ( $ currentNodeType -> getDeclaredSuperTypes ( ) as $ superType ) { $ result = $ this -> traverseSuperTypes ( $ superType , $ constraintNodeTypeName , $ distance ) ; if ( $ result !== null ) { return $ result ; } } return null ; }
This method traverses the given node type to find the first super type that matches the constraint node type.
In case the hierarchy has more than one way of finding a path to the node type it's not taken into account,
since the first matched is returned. This is accepted on purpose for performance reasons and due to the fact
that such hierarchies should be avoided.

@param NodeType $currentNodeType
@param string $constraintNodeTypeName
@param integer $distance
@return integer or NULL if no NodeType matched
This method traverses the given node type to find the first super type that matches the constraint node type . In case the hierarchy has more than one way of finding a path to the node type it s not taken into account since the first matched is returned . This is accepted on purpose for performance reasons and due to the fact that such hierarchies should be avoided .