Installs a dependency
@param BundleDependency $dependency
@return boolean
346514
private function InstallDependency(BundleDependency $dependency)
    {
        $bundle = $dependency->BundleName();
        if (array_key_exists($bundle, $this->failedBundles))
        {
            return false;
        }
        $installedVersion = $this->InstalledVersion($bundle);
        $manifest = ClassFinder::Manifest($bundle);
        if (!$installedVersion || version_compare($installedVersion, $manifest->Version()) < 0)
        {
            if (!$this->InstallBundle($bundle))
            {
                return false;
            }
        }
        return true;
    }
1370129
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        new Textpattern();
        parent::install($repo, $package);
        $plugin = new $this->textpatternPackager($this->getInstallPath($package), $package);
        $plugin->install();
    }
1274352
private function getAdditionalInstaller(InstallableInterface $bundle)
    {
        $installer = $bundle->getAdditionalInstaller();

        if ($installer instanceof AdditionalInstallerInterface) {
            $installer->setEnvironment($this->environment);
            $installer->setLogger($this->logger);

            if ($installer instanceof ContainerAwareInterface) {
                $installer->setContainer($this->container);
            }

            return $installer;
        }

        return false;
    }
929809
public static function setDependencies($dependencies) {
		self::$dependencies = [];
		foreach ($dependencies as $k => $v) {
			self::addDependency($k, $v);
		}
	}
718550
private Set<String> getClosureModuleDependencies(JoinableResourceBundle bundle, List<String> dependencies) {

		Set<String> bundleDependencies = new HashSet<>();
		if (bundle.getDependencies() != null) {
			for (JoinableResourceBundle depBundle : bundle.getDependencies()) {
				bundleDependencies.add(depBundle.getName());
			}
		}

		for (String depBundleName : dependencies) {
			if (bundle.getInclusionPattern().isGlobal() && depBundleName.equals(bundle.getName())) {
				break;
			} else {
				bundleDependencies.add(depBundleName);
			}
		}
		return bundleDependencies;
	}
244529
public static function hasDependency($locale) {
		$locale = PropelL10n::normalize($locale);
		return isset(self::$dependencies[$locale]);
	}
369092
public function hasDependencies()
    {
        foreach ($this->dependencies as $key) {
            if (isset($this->config[$key]) && $this->config[$key]) {
                return true;
            }
        }

        return false;
    }
756938
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        $extra = $package->getExtra();

        if (array_key_exists('pxb-config', $extra)) {
            $this->loadModule($package, $extra['pxb-config']);
        }

        parent::install($repo, $package);
    }
746552
public function addDependency( common_configuration_Component $component,  common_configuration_Component $dependency)
    {
        
        $dependencies = $this->getDependencies();
        
    	$found = false;
        foreach ($dependencies as $dep){
        	if ($dependency === $dep['component'] && $component === $dep['isDependencyOf']){
        		$found = true;
        		break;
        	}
        }
    	
        if (false == $found){
        	$dependencies[] = array('component' => $dependency, 'isDependencyOf' => $component);
        	$this->setDependencies($dependencies);
        }
        
    }
261655
public function updatePackageDependencies($options = [])
    {
        $process = $this->getProcess();

        $processCommand = trim($this->findComposer() . ' update ' .
                               $this->prepareOptions($options, ['--no-progress', '--no-ansi']));

        $process->setCommandLine($processCommand);

        chdir($this->workingPath);
        $this->log->info('Changing working directory for Composer update', ['directory' => $this->workingPath]);
        $this->log->info('Running Composer command', ['command' => $processCommand]);
        $process->run();

        if ($process->isSuccessful() == false) {
            $this->restoreWorkingDirectory();
            $composerError = $process->getErrorOutput();

            $this->log->error('Composer update process failure', ['composer' => $composerError]);

            throw new PackageInstallationException($process->getErrorOutput(),
                "There was an error updating the dependencies." . PHP_EOL .
                'Composer is reporting the following error(s):' . PHP_EOL . '--> ' . $composerError);
        }

        $this->restoreWorkingDirectory();
        $this->log->info('Package template dependencies updated', ['directory' => $this->workingPath]);
        return true;
    }
529267
public function installDependencies($destination, array $dependencies, $global = false)
    {
        $success = true;
        foreach ($dependencies as $stack => $stackDependencies) {
            $manager = $this->getManager($stack);
            $this->output->writeln(sprintf(
                "Installing <info>%s</info> dependencies with '%s': %s",
                $stack,
                $manager->getCommandName(),
                implode(', ', array_keys($stackDependencies))
            ));
            if (!$manager->isAvailable()) {
                $this->output->writeln(sprintf(
                    "Cannot install <comment>%s</comment> dependencies: '%s' is not installed.",
                    $stack,
                    $manager->getCommandName()
                ));
                if ($manager->getInstallHelp()) {
                    $this->output->writeln($manager->getInstallHelp());
                }
                $success = false;
                continue;
            }
            $path = $destination . '/' . $stack;
            $this->ensureDirectory($path);
            $manager->install($path, $stackDependencies, $global);
        }

        return $success;
    }
846637
public function addDependency(ModuleInterface $depends)
    {
        if ($depends->getFiles() === []) {
            foreach ($depends->getDependencies() as $dependency) {
                $this->addDependency($dependency);
            }

            return $this;
        }

        $this->dependencies[$depends->getName()] = $depends;

        return $this;
    }
493956
public function isSharedPackage(PackageInterface $package)
    {
        $prettyName = $package->getPrettyName();

        // Avoid putting this package into dependencies folder, because on the first installation the package won't be
        // installed in dependencies folder but in the vendor folder.
        // So I prefer keeping this behavior for further installs.
        if (SharedPackageInstaller::PACKAGE_PRETTY_NAME === $prettyName) {
            return false;
        }

        if ($this->areAllShared || SharedPackageInstaller::PACKAGE_TYPE === $package->getType()) {
            return true;
        }

        foreach ($this->packageCallbacks as $equalityCallback) {
            if ($equalityCallback($prettyName)) {
                return true;
            }
        }

        return false;
    }
1209710
public function addDependency(string $dependencyName): self
    {
        if (!property_exists($this->loadInfos, 'require')) {
            $this->loadInfos->require = [];
        }
        
        if (!is_array($this->loadInfos->require)) {
            $this->loadInfos->require = [$this->loadInfos->require];
        }
        
        $this->loadInfos->require[] = $dependencyName;
        
        return $this;
    }
1113597
public boolean dependsOn(DependencyNode dependency) {
        boolean dependsDirectly = dependenciesVia.contains(dependency);
        if (dependsDirectly)
            return true;
        for (DependencyNode reqDependency : dependency.dependantsVia) {
            if (dependsOn(reqDependency))
                return true;
        }
        return false;
    }
704111
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;
    }
1294255
protected function resolveDependenciesForAsset(&$assets, $asset, $replaces)
    {
        foreach ($assets as $name => $value) {
            $changed = false;

            foreach ($value['dependencies'] as $key => $dependency) {
                if (in_array($dependency, $replaces)) {
                    $changed = true;
                    unset($value['dependencies'][$key]);
                }
            }

            if ($changed) {
                $value['dependencies'][]       = $asset;
                $assets[$name]['dependencies'] = $value['dependencies'];
            }
        }

        $assets[$asset]['replaces'] = [];
    }