public function addDependency($moduleName, $dependency)
{
if (!isset($this->moduleNames[$dependency])) {
throw new RuntimeException(sprintf('The module "%s" does not exist in the graph.', $dependency));
}
if (!isset($this->moduleNames[$moduleName])) {
throw new RuntimeException(sprintf('The module "%s" does not exist in the graph.', $moduleName));
}
if (null !== ($path = $this->getPath($dependency, $moduleName))) {
$last = array_pop($path);
throw new CyclicDependencyException(sprintf('A cyclic dependency was discovered between the modules "%s" ' . 'and "%s". Please check the "override" keys defined in these ' . 'modules.', implode('", "', $path), $last));
}
$this->dependencies[$moduleName][$dependency] = true;
}