Puli\Manager\Conflict\DependencyGraph::hasPath PHP Method

hasPath() public method

Returns whether a path exists from a module to a dependency.
public hasPath ( string $moduleName, string $dependency ) : boolean
$moduleName string The module name.
$dependency string The name of the dependency.
return boolean Whether a path exists from the origin to the target module.
    public function hasPath($moduleName, $dependency)
    {
        // does not exist in the graph
        if (!isset($this->dependencies[$moduleName])) {
            return false;
        }
        // adjacent node
        if (isset($this->dependencies[$moduleName][$dependency])) {
            return true;
        }
        // DFS
        foreach ($this->dependencies[$moduleName] as $predecessor => $_) {
            if ($this->hasPath($predecessor, $dependency)) {
                return true;
            }
        }
        return false;
    }