@param string     $name
@param Dependency $dependency

@return $this
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;
    }
259187
public static function addDependency($dependency) {
		if (!isset(self::$instance[get_class($dependency)])) {
			self::$instance[get_class($dependency)] = $dependency;
		}
	}
790256
public function newToConstructor(
        \ReflectionClass $class,
        string $name,
        InjectionPoints $injectionPoints = null,
        \ReflectionMethod $postConstruct = null
    ) : Dependency {
        $setterMethods = $injectionPoints ? $injectionPoints($class->name) : new SetterMethods([]);
        $newInstance = new NewInstance($class, $setterMethods, new Name($name));

        return new Dependency($newInstance, $postConstruct);
    }
101025
public function setDependencies(array $dependencies)
    {
        $this->dependencies = array_values(array_filter($dependencies, function ($dependency): bool {
            return $dependency instanceof Dependency;
        }));
        return $this;
    }
784276
public function add(Dependency $dependency) : DependencySet
    {
        $clone = clone $this;
        if ($this->contains($dependency)
            || $dependency->count() === 0) {
            return $clone;
        }

        $clone->collection[] = $dependency;
        return $clone;
    }
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;
    }
630513
protected function init( $product, $dependency = 'boldgrid/library' ) {
		$this->product = $product;
		$this->dependency = $dependency;
		Option::init();
		$this->libraries = Option::get( 'library' );
		$this->verify();
	}
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;
    }
870714
public function registerHelper($name, $provider)
    {
        $this->formatter->getDependencies()->register(
            $this->helperName($name),
            $provider
        );

        return $this;
    }
697229
public function hasDependency($dependency = null)
    {
        if (is_null($dependency)) {
            return !empty($this->dependency);
        }

        return in_array($dependency, $this->dependency);
    }
46370
public function style($name, $source, $dependencies = [], $attributes = [], $replaces = [])
    {
        if (!array_key_exists('media', $attributes)) {
            $attributes['media'] = 'all';
        }

        $this->register('style', $name, $source, $dependencies, $attributes, $replaces);

        return $this;
    }
1097585
public function setSingletonRule ($identifier, $rule, $force = false)
		{
			if (! $force && isset($this->rules[$identifier])) {
				throw new DependencyException('Attempt to override singleton rule ' . $identifier);
			}

			$this->rules[$identifier] = new SingletonCallbackRule($this, $rule);

			return $this;
		}
958440
public DependencyList add(PersistentDependency 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;
  }
620119
public function addDependency($packages)
    {
        $packages = is_array($packages) ? $packages : func_get_args();

        foreach ($packages as $package) {
            $this->dependency[] = $package;
        }

        return $this;
    }
1011074
public function setDependencyResolver(DependencyResolver $dependencyResolver)
    {
        if ($this->dependencyResolver != null) {
            throw new \LogicException('There is an instance of DependencyManager class in class ContentManager.');
        }

        $this->dependencyResolver = $dependencyResolver;
    }
905903
public void addDependency(final Dependency dependency) {
        if(dependency != null && !dependencies.contains(dependency)){
            this.dependencies.add(dependency);
        }
    }
102933
public function provider($name, $provider)
    {
        if (!is_array($provider) && is_callable($provider)) {
            $provider = [$provider];
        }
        if (!is_array($provider)) {
            throw new DependencyException(
                'Invalid provider passed to '.$name.', '.
                'it must be an array or a callable function.'
            );
        }

        $dependencies = $provider;
        $value = array_pop($dependencies);

        return $this->set($name, new Dependency($value, $name, $dependencies));
    }