function _detectDepCycle(&$deplinks)
{
do {
$keepgoing = false;
foreach ($deplinks as $dep => $parents) {
foreach ($parents as $parent => $unused) {
// reset the parent cycle detector
$this->_testCycle(null, null, null);
if ($this->_testCycle($dep, $deplinks, $parent)) {
$keepgoing = true;
unset($deplinks[$dep][$parent]);
if (count($deplinks[$dep]) == 0) {
unset($deplinks[$dep]);
}
continue 3;
}
}
}
} while ($keepgoing);
}