function _testCycle($test, $deplinks, $dep)
{
static $visited = array();
if ($test === null) {
$visited = array();
return;
}
// this happens when a parent has a dep cycle on another dependency
// but the child is not part of the cycle
if (isset($visited[$dep])) {
return false;
}
$visited[$dep] = 1;
if ($test == $dep) {
return true;
}
if (isset($deplinks[$dep])) {
if (in_array($test, array_keys($deplinks[$dep]), true)) {
return true;
}
foreach ($deplinks[$dep] as $parent => $unused) {
if ($this->_testCycle($test, $deplinks, $parent)) {
return true;
}
}
}
return false;
}