Adds a dependency from one to another module.

@param string $moduleName The module name.
@param string $dependency The name of the dependency.
178097
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;
    }
136466
public function addNode(DependencyNode $node)
    {
        if (!$this->dependencies->contains($node)) {
            $this->dependencies->attach($node, new ArrayObject());
            $this->nodes[] = $node;

            foreach ($node->getDependencies() as $depency) {
                $this->addDependency($node, $depency);
            }
        }
    }
1246877
private function loadRequiredModules(
		Module $module,
		&$modules,
		array $moduleList,
		DependencyInjectionContainer $dic) {
		foreach ($module->getRequiredModules() as $requiredModule) {
			if (!\in_array($requiredModule, $moduleList)) {
				$this->loadModule($requiredModule, $modules, $moduleList, $dic);
				if ($module instanceof RequiredModuleAwareModule) {
					$module->addRequiredModule($dic->make($requiredModule));
				}
			}
		}
	}
251170
public DependencyContainer add(Dependency dependency)
  {
    if (dependency == this)
      throw new IllegalArgumentException("Can't add self as a dependency.");
    
    if (! _dependencyList.contains(dependency))
      _dependencyList.add(dependency);

    // server/1d0w
    // XXX: _lastCheckTime = 0;

    return this;
  }
1097637
@SuppressWarnings("ReferenceEquality")
    public synchronized void addRelatedDependency(Dependency dependency) {
        if (this == dependency) {
            LOGGER.warn("Attempted to add a circular reference - please post the log file to issue #172 here "
                    + "https://github.com/jeremylong/DependencyCheck/issues/172");
            LOGGER.debug("this: {}", this);
            LOGGER.debug("dependency: {}", dependency);
        } else if (!relatedDependencies.add(dependency)) {
            LOGGER.debug("Failed to add dependency, likely due to referencing the same file as another dependency in the set.");
            LOGGER.debug("this: {}", this);
            LOGGER.debug("dependency: {}", dependency);
        }
    }
1112717
public function addScript($handle, $script, array $dependency = [])
    {
        if (is_null($handle)) {
            $handle = $script;
        }

        $this->package->js($handle, $script, $dependency, true);

        return $this;
    }
154553
public void addDependency(String name, String version) {

        CmsModuleVersion moduleVersion = new CmsModuleVersion(version);

        CmsModuleDependency dependency = new CmsModuleDependency(name, moduleVersion);
        m_dependencies.add(dependency);

        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_ADD_MOD_DEPENDENCY_2, name, version));
        }
    }
512087
public function set($name, Dependency $dependency)
    {
        $required = isset($this->dependencies[$name]) && $this->dependencies[$name]->isRequired();
        $this->dependencies[$name] = new Requirement($dependency, $required);

        return $this;
    }
434675
public function add($name, $source, $dependencies = array(), $attributes = array())
    {
        $this->added($name, $source, $dependencies, $attributes);
    }
473504
private static void addDependency(List<Dependency> dependencies, MavenCoordinates requiredArtifact, Constants.ArtifactType type, String scope) {
		Dependency dependency = new Dependency();
		dependency.setGroupId(requiredArtifact.getGroupId());
		dependency.setArtifactId(requiredArtifact.getArtifactId());
		dependency.setVersion(requiredArtifact.getVersion());

		if(scope!=null){
			dependency.setScope(scope);
		}
		if (type != null) {
			dependency.setType(type.getType());
		}
		dependencies.add(dependency);
	}
1068320
protected String addDependency(FunctionalTaskItem dependency) {
        Objects.requireNonNull(dependency);
        return this.taskGroup().addDependency(dependency);
    }
905903
public void addDependency(final Dependency dependency) {
        if(dependency != null && !dependencies.contains(dependency)){
            this.dependencies.add(dependency);
        }
    }
1116553
public function addDependencyPackage($name, $channel, $minVersion, $maxVersion, $files = array())
    {
        $parent = $this->_packageXml->dependencies;
        $parent = $this->_getNode('required', $parent);
        $parent = $parent->addChild('package');
        $parent->addChild('name', $name);
        $parent->addChild('channel', $channel);
        $parent->addChild('min', $minVersion);
        $parent->addChild('max', $maxVersion);
        if(count($files)) {
            $parent = $parent->addChild('files');
            foreach($files as $row) {
                if(!empty($row['target']) && !empty($row['path'])) {
                    $node = $parent->addChild("file");
                    $node["target"] = $row['target'];
                    $node["path"] =  $row['path'];

                }
            }
        }
        return $this;
    }
1226370
public function getPath($moduleName, $dependency)
    {
        if ($this->getPathDFS($moduleName, $dependency, $reversePath)) {
            return array_reverse($reversePath);
        }

        return null;
    }
784276
public function add(Dependency $dependency) : DependencySet
    {
        $clone = clone $this;
        if ($this->contains($dependency)
            || $dependency->count() === 0) {
            return $clone;
        }

        $clone->collection[] = $dependency;
        return $clone;
    }
530363
protected function populateDataInModule(string $moduleName) : void
    {
        if ('' === $moduleName) {
            return;
        }

        if (in_array($moduleName, $this->skipModules)) {
            return;
        }

        $module = $this->getCSVModuleAttr($moduleName);

        if (empty($module)) {
            return;
        }

        $table = TableRegistry::get($moduleName);

        for ($count = 0; $count < $this->numberOfRecords; $count++) {
            $entity = $table->newEntity();

            $data = [];
            foreach ($module as $fieldName => $fieldData) {
                if (empty($fieldData['type'])) {
                    continue;
                }

                if ($this->isCombinedField($fieldData['type'])) {
                    $fields = $this->getCombinedFieldValueBasedOnType($fieldData['type'], '', (string)$fieldName);
                    foreach ($fields as $field => $value) {
                        $data[$field] = $value;
                    }
                    continue;
                }

                $fieldValue = $this->getFieldValueBasedOnType($fieldData['type']);
                if (empty($fieldValue)) {
                    continue;
                }
                $data[$fieldName] = $fieldValue;
            }
            $entity = $table->patchEntity($entity, $data);
            if ($table->save($entity)) {
                $id = $entity->id;
            }
        }
        $this->modulesPolpulatedWithData[] = $moduleName;
        $this->out($moduleName);
    }
1009798
public function isOperational($moduleName) {
    	if(!array_key_exists($moduleName, $this->modules_list)) {
    		if($module = fw\Module::getModuleByName($moduleName)) {
    			if($module instanceof DependentInterface) {
    				if($module->validatePrerequisites()) {
    					$this->modules_list[$moduleName] = TRUE;
    					return true;
    				} else {
    					// Do not cache the result,
    					// as they could change by the next call to the method
    					return false;
    				}
    			}
    			else {
    				$this->modules_list[$moduleName] = TRUE;
    				return true;
    			}
    		}
    		else {
    			$this->modules_list[$moduleName] = FALSE;
    		}
    	}
    	return $this->modules_list[$moduleName];
    	
    }