Find any cyclic dependencies.

@param $appName
@param $node
@param $getDependency

@throws \Eddmash\PowerOrm\Exception\CircularDependencyError
420518
private function detectCircularDepedency($appName, $node, $getDependency)
    {
        $todo = [];
        foreach ($this->nodeFamilyTree as $app => $appNodes) {
            foreach ($appNodes as $appNode) {
                $todo[$appNode->getNameWithApp()] = $getDependency($appNode->getNameWithApp());
            }
        }
        Tools::topologicalSort($todo);
    }
1352587
protected void getDependencies(JSONObject jsonObject, String rootDirectory, Collection<DependencyInfo> dependencies) {
        try {
            CommandLineProcess npmLs = new CommandLineProcess(rootDirectory, getLsCommandParams());
            npmLs.setTimeoutReadLineSeconds(this.npmTimeoutDependenciesCollector);
            List<String> linesOfNpmLs = npmLs.executeProcess();
            getDependencies(jsonObject, linesOfNpmLs, 1, dependencies);
        } catch (IOException e) {
            logger.warn("Error getting dependencies after running 'npm ls --json' on {}, error : {}", rootDirectory, e.getMessage());
            logger.debug("Error: {}", e.getStackTrace());
        }
    }
932994
public function getDependencies()
    {
        if (empty($this->dependencies)) {
            foreach ($this->getManifest()->getDependencies() as $id => $version) {
                $this->dependencies[$id] = $version;
                $dependence = $this->getExtensionManager()->getExtensionById($id);
                $this->dependencies = array_merge($this->dependencies, $dependence->getDependencies());
            }
        }
        return $this->dependencies;
    }
567529
private function injectModuleDependencies($moduleName, DependsOnModule $module)
    {
        $this->checkForMissingDependencies($moduleName, $module);

        if (!method_exists($module, '_inject')) {
            throw new ModuleException($module, 'Module requires method _inject to be defined to accept dependencies');
        }

        $dependencies = array_map(function ($dependency) {
            return $this->create($dependency, false);
        }, $this->getConfiguredDependencies($moduleName));

        call_user_func_array([$module, '_inject'], $dependencies);
    }
1097834
public function resolveDependency(string $originalDependency, ?string $newDependency) : void
    {
        if ($newDependency === null) {
            return;
        }

        // we only need to resolve a dependency one time
        if (in_array($originalDependency, $this->resolvedDependencies, true)) {
            return;
        }

        $key = array_search($originalDependency, $this->depends, true);

        if ($key === false) {
            throw new LogicException(sprintf('Could not find dependency "%s" in MetaEntry for "%s"', $originalDependency, $this->file));
        }

        $this->depends[$key]          = $newDependency;
        $this->resolvedDependencies[] = $originalDependency;
    }
1370658
public function getDependencies($id)
    {
        return (isset($this->dependenciesById[$id])) ?
            $this->dependenciesById[$id] :
            null;
    }
668673
function calculateDependencyTree(initList) {
        if (initList) {
            return _.map(initList, function (initItem) {
                return [initItem];
            });
        } else {

            var id;
            for (id in dependencyMap) {
                var mod = moduleMap[id];
                if (mod && mod.getDependencies) {

                    //dynamically look up deps with mod's getDependency function --used by express
                    var deps = normalizeServiceNames(mod.getDependencies.call(null, injectedMap['service-loader']));
                    debug('Found additional dependencies for %s', id, deps);
                    deps = _.uniq(deps.concat(dependencyMap[id]));
                    depCalc.addNode(id, deps);
                } else {
                    depCalc.addNode(id, dependencyMap[id]);
                }
            }

            //injected modules have no dependencies by default
            for (id in injectedMap) {
                if (!dependencyMap[id]) { //when you do an inject, you can specify a dependency
                    depCalc.addNode(id, []);
                }
            }

            return depCalc.calcGroups(); //could throw an error
        }
    }
1152550
final protected static function checkDependencies(string $dependencyClassName, string $dependencyPackageName)
    {
        if (!class_exists($dependencyClassName)) {
            throw new MissingDependencyException(
                sprintf(
                    'Class "%s" does not exist, please install package "%s"',
                    $dependencyClassName,
                    $dependencyPackageName
                )
            );
        }
    }
1005615
public void addDependency(final ProcessorGraphNode node) {
        Assert.isTrue(node != this, "A processor can't depends on himself");

        this.dependencies.add(node);
        node.addRequirement(this);
    }
1120666
private ExtensionDependency getDependency(Extension extension, String dependencyId)
    {
        for (ExtensionDependency dependency : extension.getDependencies()) {
            if (dependency.getId().equals(dependencyId)) {
                return dependency;
            }
        }

        return null;
    }
889322
function checkDependencies(dependencies, callback) {
  var checkedDependencies = {};

  async.each(dependencies, function (dependency, callback) {
    zoologist.getServiceDiscovery().queryForInstances(dependency, function(err, instances) {
      checkedDependencies[dependency] = ((instances) ? instances.length : 0);
      callback(err);
    });
  }, function(err) {
    // Ignore error and just return zero'd counts
    callback(null, checkedDependencies);
  });
}
1123678
protected void cyclicDependencyCheck(List<PDefinition> defs)
	{
		if (System.getProperty("skip.cyclic.check") != null)
		{
			return;		// For now, to allow us to skip if there are issues.
		}
		
		if (getErrorCount() > 0)
		{
			return;		// Can't really check everything until it's clean
		}
		
		Map<ILexNameToken, LexNameSet> dependencies = new HashMap<ILexNameToken, LexNameSet>();
		LexNameSet skip = new LexNameSet();
		PDefinitionAssistantTC assistant = assistantFactory.createPDefinitionAssistant();
		Environment globals = new FlatEnvironment(assistantFactory, defs, null);

    	for (PDefinition def: defs)
    	{
    		Environment env = new FlatEnvironment(assistantFactory, new Vector<PDefinition>());
    		FreeVarInfo empty = new FreeVarInfo(globals, env, false);
			LexNameSet freevars = assistant.getFreeVariables(def, empty);
			
			if (!freevars.isEmpty())
			{
    			for (ILexNameToken name: assistant.getVariableNames(def))
    			{
    				dependencies.put(nameFix(name.getExplicit(true)), nameFix(freevars));
    			}
			}
			
			// Skipped definition names occur in the cycle path, but are not checked
			// for cycles themselves, because they are not "initializable".
			
			if (assistant.isTypeDefinition(def) || assistant.isOperation(def))
			{
				if (def.getName() != null)
				{
					skip.add(nameFix(def.getName().getExplicit(true)));
				}
			}
    	}
    	
		for (ILexNameToken sought: dependencies.keySet())
		{
			if (!skip.contains(sought))
			{
    			Stack<ILexNameToken> stack = new Stack<ILexNameToken>();
    			stack.push(sought);
    			
    			if (reachable(sought, dependencies.get(sought), dependencies, stack))
    			{
    	    		report(3355, "Cyclic dependency detected for " + sought, sought.getLocation());
    	    		detail("Cycle", stack.toString());
    			}
    			
    			stack.pop();
			}
		}
	}
646459
def OnDependencies(self, event):
        """"""

        dlg = DependencyDialog(self.main_window)
        dlg.ShowModal()
        dlg.Destroy()
7420
function buildDependencyGraph(module, dependencies, graph) {
	if (module && !graph[module]) {
		graph[module] = [];
	}

	var dependencyNames = Object.keys(dependencies);
	dependencyNames.forEach(function(dependencyName) {
		var dependency = dependencies[dependencyName];

		if (module && graph[module].indexOf(dependencyName) === -1) {
			graph[module].push(dependencyName);
		}

		// Traverse down to this dependency dependencies:
		// Dependency-ception.
		if (dependency.dependencies) {
			buildDependencyGraph(dependencyName, dependency.dependencies, graph);
		}
	});
}
6287
def resolve_node(self, node=None, resolved=None, seen=None):
        
        if seen is None:
            seen = []
        if resolved is None:
            resolved = []
        if node is None:
            dependencies = sorted(self._nodes.keys())
        else:
            dependencies = self._nodes[node]
            seen.append(node)
        for dependency in dependencies:
            if dependency in resolved:
                continue
            if dependency in seen:
                raise Exception('Circular dependency %s > %s', str(node),
                                str(dependency))
            self.resolve_node(dependency, resolved, seen)
        if node is not None:
            resolved.append(node)
        return resolved
1045578
protected function loadDependencies()
    {
        foreach ($this->plugins as $id => $plugin) {
            if (!$required = $this->getDependencies($plugin)) {
                continue;
            }

            $disable = false;

            foreach ($required as $require) {
                if (!$pluginObj = $this->findByIdentifier($require)) {
                    $disable = true;
                }
                elseif ($pluginObj->disabled) {
                    $disable = true;
                }
            }

            if ($disable) {
                $this->disablePlugin($id);
            }
            else {
                $this->enablePlugin($id);
            }
        }
    }
1004475
function appendDependency( $dependencySection, $parameters )
    {
        if ( !in_array( $dependencySection,
                        array( 'provides', 'requires',
                               'obsoletes', 'conflicts' ) ) )
            return false;

        $this->Parameters['dependencies'][$dependencySection][] = $parameters;
    }