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

        $this->values[$name] = $value;

        unset(
            $this->factory[$name],
            $this->factoryMap[$name],
            $this->alias[$name]
        );

        $this->removeAbstractAlias($name);
    }
public function set(string $name, $value): void
    {
        if (isset($this->active[$name])) {
            throw new InvalidArgumentException("Attempted override of existing component: {$name}");
        }

        $this->values[$name] = $value;

        unset(
            $this->factory[$name],
            $this->factoryMap[$name],
            $this->alias[$name]
        );

        $this->removeAbstractAlias($name);
    }
public function set ( string $ name , $ value ) : void { if ( isset ( $ this -> active [ $ name ] ) ) { throw new InvalidArgumentException ( "Attempted override of existing component: {$name}" ) ; } $ this -> values [ $ name ] = $ value ; unset ( $ this -> factory [ $ name ] , $ this -> factoryMap [ $ name ] , $ this -> alias [ $ name ] ) ; $ this -> removeAbstractAlias ( $ name ) ; }
Directly inject a component into the container - use this to register components that
have already been created for some reason; for example, the Composer ClassLoader.

@param string $name component name
@param mixed  $value

@return void

@throws InvalidArgumentException
Directly inject a component into the container - use this to register components that have already been created for some reason ; for example the Composer ClassLoader .