PDepend\Metrics\Analyzer\DependencyAnalyzer::collectCycle PHP Метод

collectCycle() защищенный Метод

Collects a single cycle that is reachable by this namespace. All namespaces that are part of the cylce are stored in the given $list array.
protected collectCycle ( array &$list, PDepend\Source\AST\ASTNamespace $namespace ) : boolean
$list array
$namespace PDepend\Source\AST\ASTNamespace
Результат boolean If this method detects a cycle the return value is true otherwise this method will return false.
    protected function collectCycle(array &$list, ASTNamespace $namespace)
    {
        if (in_array($namespace, $list, true)) {
            $list[] = $namespace;
            return true;
        }
        $list[] = $namespace;
        foreach ($this->getEfferents($namespace) as $efferent) {
            if ($this->collectCycle($list, $efferent)) {
                return true;
            }
        }
        if (is_int($idx = array_search($namespace, $list, true))) {
            unset($list[$idx]);
        }
        return false;
    }