protected static function detectLoop($parentID, $childID, $vid)
    {
        if ($childID === $parentID) {
            return true;
        }

        foreach (static::getChildren($childID, $vid) as $grandchild) {
            if (static::detectLoop($parentID, $grandchild, $vid)) {
                return true;
            }
        }

        return false;
    }
protected static function detectLoop($parentID, $childID, $vid)
    {
        if ($childID === $parentID) {
            return true;
        }

        foreach (static::getChildren($childID, $vid) as $grandchild) {
            if (static::detectLoop($parentID, $grandchild, $vid)) {
                return true;
            }
        }

        return false;
    }
protected static function detectLoop ( $ parentID , $ childID , $ vid ) { if ( $ childID === $ parentID ) { return true ; } foreach ( static :: getChildren ( $ childID , $ vid ) as $ grandchild ) { if ( static :: detectLoop ( $ parentID , $ grandchild , $ vid ) ) { return true ; } } return false ; }
Checks whether there is a loop in the hierarchy.
@param int $parentID the parent item
@param int $childID the child item to be added to the hierarchy
@return boolean whether a loop exists
Checks whether there is a loop in the hierarchy .