Adds the given dependencies to the collectedDependencies without duplicating values and while maintining serial numerical index

@param string[] $dependenciesToAdd
@return $this
433890
public function addDependencies(array $dependenciesToAdd) {
    $this->setCollectedDependencies(array_merge(array_unique(array_merge($this->getCollectedDependencies(), $dependenciesToAdd))));
    return $this;
  }
539607
protected function resolveDependencies(array $dependencies, array $parameters = [])
    {
        $results = [];
        foreach ($dependencies as $dependency) {
            if (array_key_exists($dependency->name, $parameters)) { // Parameter value is given
                $results[] = $parameters[$dependency->name];
            } else { // Parameter value is not given
                $results[] = is_null($class = $dependency->getClass())
                    ? $dependency->getDefaultValue()
                    : $this->getInstance($dependency->getClass()->name);
            }
        }

        return $results;
    }
954490
public function addDependencyExtension($name, $minVersion, $maxVersion)
    {
        $parent = $this->_packageXml->dependencies;
        $parent = $this->_getNode('required', $parent);
        $parent = $parent->addChild('extension');
        $parent->addChild('name', $name);
        $parent->addChild('min', $minVersion);
        $parent->addChild('max', $maxVersion);
        return $this;
    }
1327569
public function resolveDependencies(array $dependencies, $params = null)
    {
        foreach ($dependencies as &$dependency) {
            if (is_null($dependency)) {
                $dependency = null;
            } else if ($dependency == 'array') {
                $dependency = [];
            } else {

                if ($this->provider->hasProvider($dependency)) {
                    $dependency = $this->provider->resolve($dependency, $params);
                } else {
                    $dependency = $this->make($dependency, $params);
                }
            }
        }

        return $dependencies;
    }
24773
public function addDependency(DependencyNode $node, DependencyNode $dependsOn)
    {
        if (!$this->dependencies->contains($node)) {
            $this->addNode($node);
        }
        if (!$this->dependencies->contains($dependsOn)) {
            $this->addNode($dependsOn);
        }

        if (!$this->arrayObjectContains($dependsOn, $this->dependencies[$node])) {
            $this->dependencies[$node]->append($dependsOn);
        }

        $node->dependsOn($dependsOn);
    }
1077385
private function addDependencyOperations() {
    $operations = [];

    foreach ($this->dependencies as $module => $type) {
      $operations[] = [
        [static::class, 'installDependency'],
        [
          $module,
          $type,
        ],
      ];
    }

    return $operations;
  }
596911
public function installDependencies(InstallerInterface $installer)
    {
        $decode = $this->config->getBowerFileContent();
        if (!empty($decode['dependencies'])) {
            foreach ($decode['dependencies'] as $name => $requiredVersion) {
                if (false !== strpos($requiredVersion, 'github')) {
                    list($name, $requiredVersion) = explode('#', $requiredVersion);
                }
                $package = new Package($name, $requiredVersion);
                $this->installPackage($package, $installer, true);
            }
        }
    }
1085945
public function addDependency($fromHash, $toHash)
    {
        $definition = $this->nodeList[$fromHash];

        $definition->dependencyList[] = $toHash;
    }
1145618
public function registerInteractorDependency($dependencyName, $dependencyValue, $interactorName)
    {
        if (! $this->globalDependencies->has($dependencyName)) {
            $this->interactorDependencies->addDependency($dependencyName, $dependencyValue, $interactorName);
        }
    }
952446
private Collection<DependencyInfo> createDependencyInfos(Collection<PhpPackage> phpPackages, Collection<DependencyInfo> dependencyInfos, Collection<String> directDependencies) {
        HashMap<DependencyInfo, Collection<String>> parentToChildMap = new HashMap<>();
        HashMap<String, DependencyInfo> packageDependencyMap = new HashMap<>();
        // collect packages data and create its dependencyInfo
        for (PhpPackage phpPackage : phpPackages) {
            DependencyInfo dependencyInfo = createDependencyInfo(phpPackage);
            if (dependencyInfo != null) {
                parentToChildMap.put(dependencyInfo, phpPackage.getPackageRequire().keySet());
                packageDependencyMap.put(phpPackage.getName(), dependencyInfo);
            } else {
                logger.debug("Didn't succeed to create dependencyInfo for {}", phpPackage.getName());
            }
        }
        if (!packageDependencyMap.isEmpty()) {
            for (String directDependency : directDependencies) {
                // create hierarchy tree
                DependencyInfo dependencyInfo = packageDependencyMap.get(directDependency);
                if (dependencyInfo != null) {
                    collectChildren(dependencyInfo, packageDependencyMap, parentToChildMap);
                    dependencyInfos.add(dependencyInfo);
                } else {
                    logger.debug("Didn't found {} in map {}", directDependency, packageDependencyMap.getClass().getName());
                }
            }
        } else {
            logger.debug("The map {} is empty ", packageDependencyMap.getClass().getName());
        }
        return dependencyInfos;
    }
919819
public function importDependencyFiles(QtiResource $qtiItemResource, $dependencies)
    {
        $qtiFile = $this->getSource() . \helpers_File::urlToPath($qtiItemResource->getFile());
        foreach ($qtiItemResource->getDependencies() as $dependenciesFile) {
            if (!isset($dependencies[$dependenciesFile])) {
                continue;
            }
            $absolutePath = $this->getAbsolutePath($dependencies[$dependenciesFile]->getFile());
            $relativePath = $this->getRelativePath($qtiFile, $absolutePath);
            try {
                $this->importAsset($absolutePath, $relativePath);
            } catch(\common_Exception $e) {
                throw new AssetManagerException(
                    'Error occurs during dependency assets handling for item: ' . $qtiItemResource->getIdentifier()
                    . ', assetFile: ' . $relativePath,
                    0, $e
                );
            }
        }
        return $this;
    }
303655
public static function checkPlatformDependencies($dependencies) {
        if (is_array($dependencies)) {
            foreach ($dependencies as $depName => $depRequire) {
                switch ($depName) {
                    case 'php':
                        if (self::satisfies(PHP_VERSION, $depRequire)) {
                            unset($dependencies[$depName]);
                        }
                        break;
                    default:
                        break;
                }
            }
        }
        return $dependencies;
    }
181903
public function addDependency($dep)
    {
        if (is_array($dep)) {
            $this->dependencies = array_merge($this->dependencies, $dep);
        } else {
            $this->dependencies[] = $dep;
        }
    }
1239354
public static function addDependency($locale, $dependsOn) {
		$locale = self::normalize($locale);
		$dependsOn = self::normalize($dependsOn);
		self::$dependencies[$locale] = $dependsOn;
	}
762689
public function setDependencyPhpExtensions($extensions)
    {
        foreach($extensions as $_extension) {
            $this->addDependencyExtension(
                $_extension['name'],
                $_extension['min_version'],
                $_extension['max_version']
            );
        }
        return $this;
    }
1326256
protected function createBundles(array $dependencies)
    {
        foreach ($dependencies as $bundleClass) {
            $name = substr($bundleClass, strrpos($bundleClass, '\\') + 1);

            if (false === isset($this->bundles[$name])) {
                $bundle = new $bundleClass();
                $this->bundles[$name] = $bundleClass;
                $this->instances[$name] = $bundle;

                if ($bundle instanceof BundleDependencyInterface) {
                    $this->createBundles($bundle->getBundleDependencies());
                }
            }
        }

        return count($this->instances) > 0;
    }
61819
public function setDependencies(array $dependencies)
    {
        $this->dependencies = [];

        foreach ($dependencies as $dependency) {
            if (!($dependency instanceof ModuleInterface)) {
                throw new InvalidParamException('Dependency must implement ModuleInterface');
            }

            $this->dependencies[] = $dependency;
        }

        return $this;
    }