@param Dependency $from
@param Dependency $to

@return DependencyMap
328561
public function add(Dependency $from, Dependency $to) : self
    {
        $clone = clone $this;
        if ($from->equals($to)
            || $from->count() === 0
            || $to->count() === 0
            || \in_array($to->toString(), ['self', 'parent', 'static'])) {
            return $clone;
        }

        if (array_key_exists($from->toString(), $clone->map)) {
            $clone->map[$from->toString()][self::$VALUE] = $clone->map[$from->toString()][self::$VALUE]->add($to);
        } else {
            $clone->map[$from->toString()] = [
                self::$KEY      => $from,
                self::$VALUE    => (new DependencySet())->add($to),
            ];
        }
        return $clone;
    }
1251544
public static function rename($from, $to)
    {
        if (!self::existe($from)) {
            throw new SchemaTableNotExistException($from);
        } elseif (self::existe($to)) {
            throw new SchemaTableExistsException($to);
        } else {
            $from = self::table($from);
            $to = self::table($to);
            //
            return Database::exec('RENAME TABLE '.$from.' TO '.$to);
        }
    }
1123646
private function resolvePrimitiveParameter(\ReflectionParameter $dependency)
    {
        if ($dependency->isDefaultValueAvailable()) {
            return $dependency->getDefaultValue();
        }

        $class         = $dependency->getDeclaringClass()->getName();
        $method        = $dependency->getDeclaringFunction()->getName();
        $parameterName = $dependency->getName();

        throw new \OutOfBoundsException("Parameter {$parameterName} is not supplied for {$class}::{$method}.");
    }
1049982
public function register_dependency(setting_dependency $dependency) {
        if ($this->is_circular_reference($dependency->get_dependent_setting())) {
            $a = new stdclass();
            $a->alreadydependent = $this->name;
            $a->main = $dependency->get_dependent_setting()->get_name();
            throw new base_setting_exception('setting_circular_reference', $a);
        }
        $this->dependencies[$dependency->get_dependent_setting()->get_name()] = $dependency;
        $dependency->get_dependent_setting()->register_dependent_dependency($dependency);
    }
721935
public static function move($from, $to)
    {
        return self::copy($from, $to) && self::delete($from);
    }
1184139
public static function buildDependencies(DependencyBuilder $dependencies)
    {
        $classes = [
            // guarantee DoctrineBundle
            DoctrineBundle::class,
            // guarantee ORM
            Column::class,
        ];

        foreach ($classes as $class) {
            $dependencies->addClassDependency(
                $class,
                'orm'
            );
        }
    }
976300
protected function publishDirectory($from, $to)
    {
        $this->moveManagedFiles(new MountManager([
            'from' => new Flysystem(new LocalAdapter($from)),
            'to' => new Flysystem(new LocalAdapter($to)),
        ]));
    }
73872
public function getDependencyMap($interactorName)
    {
        $dependencies = new DependencyMap();
        $dependencies->addMap($this->globalDependencies->getDependencyMap());

        if ($this->interactorDependencies->has($interactorName)) {
            $dependencies->addMap($this->interactorDependencies->getDependencyMap($interactorName));
        }

        return $dependencies;
    }
823109
public static function fetchDependency(string $dependency)
    {
        $container = self::buildContainer();

        if ($container->has($dependency)) {
            return $container->get($dependency);
        }

        return null;
    }
550143
private function regenerateDependencyMap () : DependencyMap
    {
        $loader = new DependencyLoader($this->namespaceRegistry, $this->logger);

        foreach ($this->dependencyFiles as $dependencyFile)
        {
            $loader->importFile($dependencyFile);
        }

        return new DependencyMap(
            $loader->getDependencyMap()
        );
    }
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;
    }
334477
public void removeDependency(T from, T to) {
      lock.writeLock().lock();
      try {
         Set<T> dependencies = outgoingEdges.get(from);
         if (dependencies == null || !dependencies.contains(to)) {
            throw new IllegalArgumentException("Inexistent dependency");
         }
         dependencies.remove(to);
         incomingEdges.get(to).remove(from);
      } finally {
         lock.writeLock().unlock();
      }
   }
561588
protected function getDependencyMapping()
    {
        $constructor = (new ReflectionClass($this->className))
            ->getConstructor();

        $dependencies = [];

        if (!is_null($constructor)) {
            foreach ($constructor->getParameters() as $param) {
                $dependencies[$param->getClass()->getName()] = $param->getName();
            }
        }

        return $dependencies;
    }
499921
public static function mergeReferences(Translation $from, Translation $to, $options = self::DEFAULTS)
    {
        if ($options & self::REFERENCES_THEIRS) {
            $to->deleteReferences();
        }

        if (!($options & self::REFERENCES_OURS)) {
            foreach ($from->getReferences() as $reference) {
                $to->addReference($reference[0], $reference[1]);
            }
        }
    }
505645
public function reduceEachDependency(\Closure $mappers) : DependencyMap
    {
        return $this->reduce(new self(), function (self $map, Dependency $from, Dependency $to) use ($mappers) {
            return $map->add($mappers($from), $mappers($to));
        });
    }
1044503
public function copy($from, $to)
    {
        $pathFrom = $this->pathRoot.ltrim($from, "/");
        $pathTo   = $this->pathRoot.ltrim($to, "/");

        if (is_dir($pathFrom)) {
            return $this->copyDir($pathFrom, $pathTo);
        } else {
            return $this->copyFile($pathFrom, $pathTo);
        }
    }
253335
public function replace($from, $to)
    {
        if (\is_callable($to)) {
            $to = $to($from, $this->string);
        }

        $this->string = \str_replace($from, $to, $this->string);
        return $this;
    }