src/Container/Container.php
public function inject(string $name, $value): void
    {
        if ($this->has($name)) {
            throw new InvalidArgumentException("Attempted override of existing component: {$name}");
        }

        $this->values[$name] = $value;
        $this->active[$name] = true;
    }
public function inject(string $name, $value): void
    {
        if ($this->has($name)) {
            throw new InvalidArgumentException("Attempted override of existing component: {$name}");
        }

        $this->values[$name] = $value;
        $this->active[$name] = true;
    }
public function inject ( string $ name , $ value ) : void { if ( $ this -> has ( $ name ) ) { throw new InvalidArgumentException ( "Attempted override of existing component: {$name}" ) ; } $ this -> values [ $ name ] = $ value ; $ this -> active [ $ name ] = true ; }
Dynamically inject a component into this Container.

Enables implementation of "auto-wiring" patterns, where missing components are injected
at run-time into a live `Container` instance.

You should always test with {@see has()} prior to injecting a component - attempting to
override an existing component will generate an exception.

@throws InvalidArgumentException if the specified component has already been defined

@param string $name component name
@param mixed  $value
Dynamically inject a component into this Container .